Setting up SQL server Azure
my feeling is to stay away from the CTP, but here’s my ‘walkthrough’
I got this email a few days ago:
Welcome to the SQL Azure CTP! We are excited to have you join us. Below are
some steps to get you started, as well as links to helpful resources.
Getting Started
1) Visit https://sql.azure.com
2) Sign in with a valid Windows LiveID
3) Enter your invitation code
Your invitation code is:
d329171f-c1fd-4060-862e-1a7f613ea8ce
4) Create your SQL Azure Server (and
databases)
So I stepped through the process, and set up an Azure database, then I found that I needed SQL server 2008 to connect to it,
I downloaded SQLManagementStudio_x86_ENU.exe from
http://www.microsoft.com/DownLoads/details.aspx?familyid=08E52AC2-1D62-45F6-9A4A-4B76A8564A2B&displaylang=en
During Install, said that I needed to reboot… when I had, so a work around was:
# Open Regedit
# Find the key "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession Manager"
# Rename the "PendingFileRenameOperations" value to "PendingFileRenameOperations2"
# Re-Run the checks
Downloaded powershell:
Uninstalled SQL server management studio express
Uninstalled Visual studio 2008
It then crashed with this error:
TITLE: SQL Server Setup failure.
——————————
SQL Server Setup has encountered the following error:
Unable to generate a temporary class (result=1).
error CS0006: Metadata file ‘C:WINDOWSassemblyGAC_MSILMSClusterLib1.0.0.0__89845dcd8080cc91MSClusterLib.dll’ could not be found
Error code 0x84B10001.
——————————
BUTTONS:
OK
——————————
Rebooted…
Deleted the PendingFileOperations Registry Key
Installed!
Tried to Connect:
ADO.NET:
Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=master;User ID=fiach;Password=myPassword;Trusted_Connection=False; Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=;User ID=fiach;Password=myPassword;Trusted_Connection=False; Copy to clipboard
ODBC:
Driver={SQL Server};Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=master;Uid=fiach;Pwd=myPassword; Driver={SQL Server};Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=;Uid=fiach;Pwd=myPassword; Copy to clipboard
OLE DB:
Provider=SQLNCLI10;Server=tcp:yitwxb6n0v.ctp.database.windows.net;Database=master;Uid=fiach;Pwd=myPasswor
TITLE: Connect to Server
——————————
Cannot connect to yitwxb6n0v.ctp.database.windows.net.
——————————
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
Invalid object name ‘sys.configurations’. (Microsoft SQL Server, Error: 208)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.9006&EvtSrc=MSSQLServer&EvtID=208&LinkId=20476
——————————
BUTTONS:
OK
——————————
Fixed using this post:
1. cancel out of the first connection dialog that pops up.
2. click on the New Query button from the toolbar (upper left)
3. entered
Server name: full servername
Login: just the username (no @…)
4. Under Options, Connect to Database, (type your database here)
5. Hit connect.
And I got in… after an hour.
Now to figure out how to copy the databases!
Changing the TTL value of a DNS record in Windows
Creating a virtual directory on Apache for Windows
Alias /db "D:sqldatabackups"
<Directory "D:sqldatabackups">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from localhost
Allow from all
</Directory>
Hope this helps
Migrating a classic ASP site from Windows to Linux
I had spare VPS server that I could use for the purpose.
First step to set up Apache on the Linux server,
/etc/apache2/sites-enabled/omadataobjects.com.conf
ServerAdmin webmaster@localhost
ServerAlias www.omadataobjects.com
DocumentRoot
/var/www/omadataobjects.com
</VirtualHost>
reload
The site was in ASP, was indexed in Google, with Page Rank, so I didn’t want to change the URLs, so I wanted to use mod_rewrite,
which I installed using Putty:
root@vps ~ # a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.
root@vps ~ # /etc/init.d/apache2 force-reload
Forcing reload of web server (apache2)… waiting .
I then created a .htaccess file in the website root
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*).asp$ /$1.php [L,NC,R=301]
</IfModule>
Which rewrites all .asp requests to .php
I then changed the extension of all .asp files to .php,
and changed
<!–#include file="header.asp"–> to <?php include("header.php"); ?>
Oh, and I had a few glitches with case-sensitivity, which Windows is less strict about.
List of Software developers, Mashup.
WORKSLINE BV SOFTWARE VOOR WERKTUIGBOUW
A M S ADVANCED MANUFACTURING SOFTWARE S R L
IMATIC SOFTWARE Y SISTEMAS INFORMÁTICA S L
SOFTWARE DEVELOPMENTS INTERNATIONAL LTD
NATRON SOFTWARE MAINTENANCE LTD
Fischer Hans Josef Software Design
PRO MEDISOFT Software Systeme für das Gesundheitswesen GmbH Hotline
DHS Media Unterhaltungs Hard und Software GmbH Co
f s Computer und Software Vertriebs GmbH
ZWEITWERK software engineering GmbH
Innovative Software Design GmbH Beratung Design Entwicklung
S I G SOFTWARE Ingenieur GmbH Automatisierungstechnik
Doors GmbH Software Consulting
COMPUTER SOFTWARE ENGINERING SRL
Erste CRG Computer u Software Vertriebs GmbH
PANORAMA SOFTWARE INTERNATIONAL LTD
OPEN MARKET INTERNET SOFTWARE BV
Carano Software Entwicklungs GmbH
Integrierte Software Technologie Roggenhof GmbH
SOC Software Outsourcing Consulting GmbH
Voigt Software und Unternehmensberatung GmbH
VSS GmbH Vertrieb von Systemen und Software
hagosoft Industrie Software GmbH
PALMA SOFTWARE AND COMPUTING SAS
Akten James Software GmbH Petersen Firmengruppe Interclearing Petersensoftware
SOCON Software Consulting GmbH
ASPIA Automatisierte Software Produktion und Informatik Architektur GmbH Groeneveld
Wannemacher Software Service GmbH Wannemacher Software Servic GmbH
Transcom Computer Hard Software
DATALINE Gesellschaft für Hard u Software Systeme mbH
Software Engineering Klaus Thiehoff
TARGET Software Vertriebs GmbH
MK tec GmbH Software und Elektronik i G
L S ADVANCED SOFTWARE DI GIUGNO E VALENTI SNC
PATIDOK Clinical Software GmbH Patidok
STACKS CONSULTING E INGENIERIA EN SOFTWARE S L
intermedix Gesellschaft für medizinische Software mbH
Sternberg Software und Computersysteme GmbH
BCIS Hard Softwaren Leipzig GmbH BCIS Hard und Software Leipzig GmbH
Plus Data Hard u Software GmbH
CSCS Computer u Software Schnäkel
TESCOM Software Systems Testing GmbH
DETEC Decision Technology Software GmbH
Attica Software Computersystems bvba
Exact Software GmbH Exact Software GmbH Software Software
Greenlab Systems GmbH Gesellschaft für med Software
CAM Service Gesellschaft für Software und Automationstechnik mbH CAM Service mbH
SACO Software and Consulting GmbH
BOSS Branchen Organisation u Software Systeme GmbH
DIALOG SOFTWARE TELECOMMUNICATIONS SRL
4D Concepts Prototyping Software und Consulting GmbH
Blue Communications Software GmbH Blue Communications Software GmbH
ORTEC NV Computer printers en software
Interactive Software Federation of Europe
BRITTANIC SOFTWARE SERVICES LTD
ReNoFlex Computer Software GmbH Vertriebsbüro
SOFTWARE VISUAL DE SANTA CLARA S L
COMSULT COMPUTER SOFTWARE CONSULTANTS
TSE Thürnau Software Entwicklung GmbH
ESYS Gesellschaft für Elektronische Systemtechnik Hard u Software mbH
SOFTWARE MACHINES AND SYSTEM DI CICCONE LUCIO C S A S
ELCOTEC Gesellschaft für Software und Systemlösungen m b H
itCampus Software und Systemhaus
S A D Software Vertriebs und Produktions GmbH
TEGIS Software GmbH Softwaretechnik
Integrated Application Software
Ulybin Gesellschaft für Business und Software GmbH
SPEA SOFTWARE AKTIENGESELLSCHAFT
Laser Soft Hard und Software Vertriebs GmbH
PC PARTNER PLUS PPP Hard u Software GmbH
MIPROTEK Gesellschaft für Hard und Software Entwicklung GmbH
Bauer Partner Consulting und Software GmbH Region Deutschland Südost
multicom Software Entwicklung Dr Ruchert Co GmbH
Related Designs Software GmbH Related Design Software GmbH
BeO Gesellschaft für standard software support mbH
Heinsohn Andreas Heinsohn Computer Zubehör Software Werkstatt
SDS Software Mußhoff und Spohr GbR
VISUAL POINT SOFTWARE DI QUARANTA TIZIANO
SSW Software Support Winter GmbH
DESARROLLO E IMPLANTACION DE SOFTWARE S L
SHS GmbH Spezial Hardware Software
Zaremba Software Engineering GmbH Z S E
Weiß Elektronik u Software GmbH
SOFTWARE OF EXCELLENCE UNITED KINGDOM LTD
TRANS NATIONS SOFTWARE DI FRANCESCO PERNIOLA
betzemeier automotive software GmbH betzmeier
Bäurer Unternehmensberatung u Software GmbH
AWIDA SOFTWARE GmbH Softwareentwicklung
Saturn Electro Handelsgesellschaft mbH Software
SysTeam Handelssysteme Software GmbH
Elite Software Aps og Verner Kristensen
Objective Software GmbH Uwe Meyer
ISIS GmbH Ingenieurbüro für Software und integrierte Systemlösungen ISIS GmbH
Unicom Computerservice und Software GmbH
Körtner Muth GmbH Software Entwicklung
CS Software Computer und Software Beratungs GmbH
Sollist Individual Software GmbH Kock
Specken Detlef Win Service Hard u Software GmbH
EPLAN Software Service GmbH Co KG
Virtual X citement Software GmbH
Phönix Computer Software Service Schulung
Ixos Software Ixos Software Internation
TOTO BIT INFORMATICA SOFTWARE E SISTEMI SPA
Heineck Heineck Ulrich Thüringer Software Service
CUSH Gruppe Dresden Computer und Software Haus GmbH
Kraus Thorsten Kraus Hard u Software Verkauf
SSR Software Entwicklung Beratung GmbH
Prosoft Software Entwicklung mbH
RiskTrak Financial Software GmbH
COMPUTER APPARATUUR PLAN 5 SOFTWARE
SILK ROAD SOFTWARE ENTERPRISE BV
SOFTWARE TEAM SRL TECNOLOGIE INFORMATICHE AVANZATE
Http Traces Wiki started.
English-Indian Locale
This is the English-Indian Locale File:
(Exported using PowerShell, see http://iformattable.blogspot.com/2008/11/dealing-with-globalization-differences.html)
<?xml version="1.0" encoding="utf-8"?>
<ldml>
<identity>
<version number="1.1">ldml version 1.1</version>
<generation date="2009-05-11" />
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:cultureInfoVersion type="1.0" />
<msLocale:cultureAndRegionInfoName type="en-IN" />
<msLocale:geoId>113</msLocale:geoId>
<msLocale:countryCode>91</msLocale:countryCode>
<msLocale:parentName type="en" />
<msLocale:languageNameAbbr type="ENN" />
<msLocale:languageIsoName type="threeLetters">eng</msLocale:languageIsoName>
<msLocale:languageIsoName type="twoLetters">en</msLocale:languageIsoName>
<msLocale:nativeName type="English (India)" />
<msLocale:regionEnglishName type="India" />
<msLocale:regionNativeName type="भारत" />
<msLocale:regionIsoName type="threeLetters">IND</msLocale:regionIsoName>
<msLocale:regionIsoName type="twoLetters">IN</msLocale:regionIsoName>
<msLocale:regionWindowsName type="threeLetters">IND</msLocale:regionWindowsName>
<msLocale:englishName type="English (India)" />
<msLocale:textInfoName type="en-IN" />
<msLocale:sortName type="en-IN" />
<msLocale:englishLanguage type="English" />
<msLocale:nativeLanguage type="English" />
<msLocale:keyboardsToInstall type="0409:00000409;" />
</special>
</identity>
<layout>
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:direction type="left-to-right" />
</special>
</layout>
<characters>
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:keyboardLayout>16393</msLocale:keyboardLayout>
<msLocale:consoleFallbackName type="en-IN" />
<msLocale:fontSignature>
<msLocale:unicodeRanges>
<msLocale:range type="0" />
<msLocale:range type="1" />
</msLocale:unicodeRanges>
<msLocale:defaultCodePages>
<msLocale:ansiCodePage>
<msLocale:codePage type="1252" />
</msLocale:ansiCodePage>
<msLocale:ansiOemCodePage />
<msLocale:oemCodePage>
<msLocale:codePage type="437" />
</msLocale:oemCodePage>
</msLocale:defaultCodePages>
<msLocale:codePages>
<msLocale:ansiCodePage>
<msLocale:codePage type="1252" />
<msLocale:codePage type="1250" />
<msLocale:codePage type="1251" />
<msLocale:codePage type="1253" />
<msLocale:codePage type="1254" />
<msLocale:codePage type="1255" />
<msLocale:codePage type="1256" />
<msLocale:codePage type="1257" />
<msLocale:codePage type="1258" />
</msLocale:ansiCodePage>
<msLocale:ansiOemCodePage>
<msLocale:codePage type="874" />
<msLocale:codePage type="932" />
<msLocale:codePage type="936" />
<msLocale:codePage type="949" />
<msLocale:codePage type="950" />
<msLocale:codePage type="1361" />
</msLocale:ansiOemCodePage>
<msLocale:oemCodePage>
<msLocale:codePage type="1258" />
<msLocale:codePage type="869" />
<msLocale:codePage type="866" />
<msLocale:codePage type="865" />
<msLocale:codePage type="864" />
<msLocale:codePage type="863" />
<msLocale:codePage type="862" />
<msLocale:codePage type="861" />
<msLocale:codePage type="860" />
<msLocale:codePage type="857" />
<msLocale:codePage type="855" />
<msLocale:codePage type="852" />
<msLocale:codePage type="775" />
<msLocale:codePage type="737" />
<msLocale:codePage type="708" />
<msLocale:codePage type="850" />
<msLocale:codePage type="437" />
</msLocale:oemCodePage>
</msLocale:codePages>
</msLocale:fontSignature>
<msLocale:scripts>
<msLocale:script type="Latn" />
</msLocale:scripts>
</special>
</characters>
<measurement>
<measurementSystem type="metric" />
<paperSize>
<height>297</height>
<width>210</width>
</paperSize>
</measurement>
<dates>
<calendars>
<default type="Gregorian" />
<calendar type="Gregorian">
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:calendarNativeName type="Gregorian Calendar" />
</special>
<months>
<monthContext type="format">
<monthWidth type="wide">
<month type="1">January</month>
<month type="2">February</month>
<month type="3">March</month>
<month type="4">April</month>
<month type="5">May</month>
<month type="6">June</month>
<month type="7">July</month>
<month type="8">August</month>
<month type="9">September</month>
<month type="10">October</month>
<month type="11">November</month>
<month type="12">December</month>
<month type="13" />
</monthWidth>
<monthWidth type="abbreviated">
<month type="1">Jan</month>
<month type="2">Feb</month>
<month type="3">Mar</month>
<month type="4">Apr</month>
<month type="5">May</month>
<month type="6">Jun</month>
<month type="7">Jul</month>
<month type="8">Aug</month>
<month type="9">Sep</month>
<month type="10">Oct</month>
<month type="11">Nov</month>
<month type="12">Dec</month>
<month type="13" />
</monthWidth>
<monthWidth type="genitive">
<month type="1">January</month>
<month type="2">February</month>
<month type="3">March</month>
<month type="4">April</month>
<month type="5">May</month>
<month type="6">June</month>
<month type="7">July</month>
<month type="8">August</month>
<month type="9">September</month>
<month type="10">October</month>
<month type="11">November</month>
<month type="12">December</month>
<month type="13" />
</monthWidth>
<monthWidth type="genitiveAbbreviated">
<month type="1">Jan</month>
<month type="2">Feb</month>
<month type="3">Mar</month>
<month type="4">Apr</month>
<month type="5">May</month>
<month type="6">Jun</month>
<month type="7">Jul</month>
<month type="8">Aug</month>
<month type="9">Sep</month>
<month type="10">Oct</month>
<month type="11">Nov</month>
<month type="12">Dec</month>
<month type="13" />
</monthWidth>
</monthContext>
</months>
<days>
<dayContext type="format">
<dayWidth type="wide">
<day type="sun">Sunday</day>
<day type="mon">Monday</day>
<day type="tue">Tuesday</day>
<day type="wed">Wednesday</day>
<day type="thu">Thursday</day>
<day type="fri">Friday</day>
<day type="sat">Saturday</day>
</dayWidth>
<dayWidth type="abbreviated">
<day type="sun">Sun</day>
<day type="mon">Mon</day>
<day type="tue">Tue</day>
<day type="wed">Wed</day>
<day type="thu">Thu</day>
<day type="fri">Fri</day>
<day type="sat">Sat</day>
</dayWidth>
<dayWidth type="shortest">
<day type="sun">Su</day>
<day type="mon">Mo</day>
<day type="tue">Tu</day>
<day type="wed">We</day>
<day type="thu">Th</day>
<day type="fri">Fr</day>
<day type="sat">Sa</day>
</dayWidth>
</dayContext>
</days>
<week>
<firstDay day="mon" />
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:weekRule type="firstDay" />
</special>
</week>
<am>AM</am>
<pm>PM</pm>
<dateFormats>
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:dateFormatLength type="long">
<msLocale:default type="0" />
<msLocale:dateFormat type="0">
<msLocale:pattern>dd MMMM yyyy</msLocale:pattern>
</msLocale:dateFormat>
<msLocale:dateFormat type="1">
<msLocale:pattern>d MMMM yyyy</msLocale:pattern>
</msLocale:dateFormat>
</msLocale:dateFormatLength>
<msLocale:dateFormatLength type="short">
<msLocale:default type="0" />
<msLocale:dateFormat type="0">
<msLocale:pattern>dd-MM-yyyy</msLocale:pattern>
</msLocale:dateFormat>
<msLocale:dateFormat type="1">
<msLocale:pattern>dd-MM-yy</msLocale:pattern>
</msLocale:dateFormat>
<msLocale:dateFormat type="2">
<msLocale:pattern>d-M-yy</msLocale:pattern>
</msLocale:dateFormat>
<msLocale:dateFormat type="3">
<msLocale:pattern>d.M.yy</msLocale:pattern>
</msLocale:dateFormat>
<msLocale:dateFormat type="4">
<msLocale:pattern>yyyy-MM-dd</msLocale:pattern>
</msLocale:dateFormat>
</msLocale:dateFormatLength>
<msLocale:yearMonthFormat>
<msLocale:default type="0" />
<msLocale:yearMonth type="0">
<msLocale:pattern>MMMM, yyyy</msLocale:pattern>
</msLocale:yearMonth>
</msLocale:yearMonthFormat>
<msLocale:monthDay>
<msLocale:pattern>MMMM dd</msLocale:pattern>
</msLocale:monthDay>
</special>
</dateFormats>
<timeFormats>
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:timeFormatLength type="long">
<msLocale:default type="0" />
<msLocale:timeFormat type="0">
<msLocale:pattern>HH:mm:ss</msLocale:pattern>
</msLocale:timeFormat>
<msLocale:timeFormat type="1">
<msLocale:pattern>H:mm:ss</msLocale:pattern>
</msLocale:timeFormat>
<msLocale:timeFormat type="2">
<msLocale:pattern>tt hh:mm:ss</msLocale:pattern>
</msLocale:timeFormat>
<msLocale:timeFormat type="3">
<msLocale:pattern>tt h:mm:ss</msLocale:pattern>
</msLocale:timeFormat>
</msLocale:timeFormatLength>
<msLocale:timeFormatLength type="short">
<msLocale:default type="0" />
<msLocale:timeFormat type="0">
<msLocale:pattern>HH:mm:ss</msLocale:pattern>
</msLocale:timeFormat>
<msLocale:timeFormat type="1">
<msLocale:pattern>H:mm:ss</msLocale:pattern>
</msLocale:timeFormat>
<msLocale:timeFormat type="2">
<msLocale:pattern>tt hh:mm:ss</msLocale:pattern>
</msLocale:timeFormat>
<msLocale:timeFormat type="3">
<msLocale:pattern>tt h:mm:ss</msLocale:pattern>
</msLocale:timeFormat>
</msLocale:timeFormatLength>
<msLocale:durationFormats>
<msLocale:default type="0" />
<msLocale:durationFormat type="0">
<msLocale:pattern>HH:mm:ss</msLocale:pattern>
</msLocale:durationFormat>
</msLocale:durationFormats>
</special>
</timeFormats>
</calendar>
<calendar type="Gregorian US">
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:calendarNativeName type="Gregorian Calendar" />
</special>
</calendar>
</calendars>
</dates>
<numbers>
<symbols>
<list>,</list>
<decimal>.</decimal>
<group>,</group>
<percentSign>%</percentSign>
<infinity type="positive">Infinity</infinity>
<infinity type="negative">-Infinity</infinity>
<nan>NaN</nan>
<PlusSign />
<minusSign>-</minusSign>
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:currencyDecimalSeparator>.</msLocale:currencyDecimalSeparator>
<msLocale:currencyGroupSeparator>,</msLocale:currencyGroupSeparator>
</special>
</symbols>
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:decimalDigits>2</msLocale:decimalDigits>
<msLocale:negativePattern type="1" />
<msLocale:currencyDecimalDigits type="2" />
<msLocale:currencyPositivePattern type="2" />
<msLocale:currencyNegativePattern type="12" />
<msLocale:percentNegativePattern type="0" />
<msLocale:percentPositivePattern type="0" />
<msLocale:leadingZero type="yes" />
<msLocale:groupSizes type="0">3</msLocale:groupSizes>
<msLocale:groupSizes type="1">2</msLocale:groupSizes>
<msLocale:currencyGroupSizes type="0">3</msLocale:currencyGroupSizes>
<msLocale:currencyGroupSizes type="1">2</msLocale:currencyGroupSizes>
<msLocale:nativeDigits type="0">0</msLocale:nativeDigits>
<msLocale:nativeDigits type="1">1</msLocale:nativeDigits>
<msLocale:nativeDigits type="2">2</msLocale:nativeDigits>
<msLocale:nativeDigits type="3">3</msLocale:nativeDigits>
<msLocale:nativeDigits type="4">4</msLocale:nativeDigits>
<msLocale:nativeDigits type="5">5</msLocale:nativeDigits>
<msLocale:nativeDigits type="6">6</msLocale:nativeDigits>
<msLocale:nativeDigits type="7">7</msLocale:nativeDigits>
<msLocale:nativeDigits type="8">8</msLocale:nativeDigits>
<msLocale:nativeDigits type="9">9</msLocale:nativeDigits>
<msLocale:digitSubstitution type="none" />
</special>
<currencies>
<currency type="default">
<symbol>Rs.</symbol>
<displayName>रुपय</displayName>
<special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml">
<msLocale:isoCurrency>INR</msLocale:isoCurrency>
<msLocale:currencyEnglishName>Indian Rupee</msLocale:currencyEnglishName>
</special>
</currency>
</currencies>
</numbers>
</ldml>
Email to SMS project
Overview
Create a windows service application written in
.NET, that will check a Pop3 email account every 5 minutes
(configurable in app.config).
On receipt of an email, in the format [number]@freebiesms.mobi, then the service will call a webservice,
(http://www.freebiesms.co.uk/sendsms.asmx?op=SendSms)
Using these parameters:
FromName: The From name in the email
FromNumber: Hard coded, as 00447834567890
ToNumber: The [number] in the email address
Message: The Body of the email, or subject line if no body. (Plain text)
locale: Derived from the prefix of the [number], 0044 is en-GB.
Full list of valid locales here: http://spreadsheets.google.com/pub?key=p_x5hMjj9OXDTjsYYhluJKQ
This list must be configurable in the app.config
Any response from the web service, either error or success must be sent back to the sender via email.
Points to note:
* Should support unicode, if email body in unicode (i.e. Russian) then the message should be in unicode.
* The service must run without any user interaction, any errors should
be logged, and ignored. The service should not stop in the event
of any failure, just try again in 5 minutes.
* I would prefer .NET 1.1 if possible.
* Help with setting up the catch-all email address, and help with installation on the server is necessary.
Sending SMS via Soap from Cocoa (Mac)
Full download can be found here;http://sites.google.com/site/freesmsuk/free-sms-iphone-app
#import "sendSms.h"
#import <libxml/xmlstring.h>
#import <CFNetwork/CFHTTPMessage.h>
#import <CFNetwork/CFHTTPStream.h>
@implementation sendSms_SendSms
@synthesize fromName;
@synthesize fromNumber;
@synthesize toNumber;
@synthesize message;
@synthesize locale;
– (id)init
{
if((self = [super init])) {
}
return self;
}
– (void)dealloc
{
[super dealloc];
}
– (NSString *)nsPrefix
{
return @"sendSms";
}
– (NSString *)serializedFormUsingElementName:(NSString *)elName
{
NSMutableString *serializedForm = [NSMutableString string];
[serializedForm appendFormat:@"<%@ xsi:type="sendSms:SendSms"", elName];
[serializedForm appendString:[self serializedAttributeString]];
[serializedForm appendFormat:@">"];
[serializedForm appendString:[self serializedElementString]];
[serializedForm appendFormat:@"n</%@>", elName];
return serializedForm;
}
– (NSString *)serializedAttributeString
{
NSMutableString *serializedForm = [NSMutableString string];
return serializedForm;
}
– (NSString *)serializedElementString
{
NSMutableString *serializedForm = [NSMutableString string];
[serializedForm appendFormat:@"n<sendSms:FromName>"];
[serializedForm appendFormat:fromName];
[serializedForm appendFormat:@"</sendSms:FromName>n"];
[serializedForm appendFormat:@"<sendSms:FromNumber>"];
[serializedForm appendFormat:fromNumber];
[serializedForm appendFormat:@"</sendSms:FromNumber>n"];
[serializedForm appendFormat:@"<sendSms:ToNumber>"];
[serializedForm appendFormat:toNumber];
[serializedForm appendFormat:@"</sendSms:ToNumber>n"];
[serializedForm appendFormat:@"<sendSms:Message>"];
[serializedForm appendFormat:message];
[serializedForm appendFormat:@"</sendSms:Message>n"];
[serializedForm appendFormat:@"<sendSms:locale>"];
[serializedForm appendFormat:locale];
[serializedForm appendFormat:@"</sendSms:locale>"];
return serializedForm;
}
/* elements */
/* attributes */
– (NSDictionary *)attributes
{
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
return attributes;
}
+ (sendSms_SendSms *)deserializeNode:(xmlNodePtr)cur
{
sendSms_SendSms *newObject = [[sendSms_SendSms new] autorelease];
[newObject deserializeAttributesFromNode:cur];
[newObject deserializeElementsFromNode:cur];
return newObject;
}
– (void)deserializeAttributesFromNode:(xmlNodePtr)cur
{
}
– (void)deserializeElementsFromNode:(xmlNodePtr)cur
{
}
@end
@implementation sendSms_SendSmsResponse
@synthesize statusString;
– (id)init
{
if((self = [super init])) {
}
return self;
}
– (void)dealloc
{
[super dealloc];
}
– (NSString *)nsPrefix
{
return @"sendSms";
}
– (NSString *)serializedFormUsingElementName:(NSString *)elName
{
NSMutableString *serializedForm = [NSMutableString string];
[serializedForm appendFormat:@"<%@ xsi:type="sendSms:SendSmsResponse"", elName];
[serializedForm appendString:[self serializedAttributeString]];
[serializedForm appendFormat:@">"];
[serializedForm appendString:[self serializedElementString]];
[serializedForm appendFormat:@"n</%@>", elName];
return serializedForm;
}
– (NSString *)serializedAttributeString
{
NSMutableString *serializedForm = [NSMutableString string];
return serializedForm;
}
– (NSString *)serializedElementString
{
NSMutableString *serializedForm = [NSMutableString string];
return serializedForm;
}
/* elements */
/* attributes */
– (NSDictionary *)attributes
{
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
return attributes;
}
+ (sendSms_SendSmsResponse *)deserializeNode:(xmlNodePtr)cur
{
sendSms_SendSmsResponse *newObject = [[sendSms_SendSmsResponse new] autorelease];
[newObject deserializeAttributesFromNode:cur];
[newObject deserializeElementsFromNode:cur];
return newObject;
}
– (void)deserializeAttributesFromNode:(xmlNodePtr)cur
{
}
– (void)deserializeElementsFromNode:(xmlNodePtr)cur
{
if(xmlStrEqual(cur->name, (const xmlChar *) "SendSmsResponse")){
// In this case we have got the ok answer
statusString = @"SENT";
} else if (xmlStrEqual(cur->name, (const xmlChar *) "Fault")){
// Something is wrong
NSLog(@" bodyNode last prev last content in deserializeElementsFromNode %s", cur->last->prev->last->content);
NSString *tmp = [NSString stringWithFormat:@"%s", cur->last->prev->last->content ];
// Strip out the garbage
//NSString *tmp1 = [tmp substringToIndex:174];
//NSString *tmp2 = [tmp1 substringFromIndex:106];
// Strip out the garbage
NSString *tmp1 = [tmp substringToIndex:174];
NSLog(@" tmp1 %@", tmp1);
NSRange nsr = [tmp rangeOfString:@" at"];
// Remove trailer message after at
if (nsr.location < 174 ){
tmp1 = [tmp1 substringToIndex:nsr.location];
};
NSLog(@" tmp1 %@", tmp1);
NSString *tmp2 = [tmp1 substringFromIndex:106];
NSLog(@" tmp2 %@Ò", tmp2);
statusString = [[NSString alloc] initWithString:tmp2 ];
}
if (statusString == NULL){
statusString = @"UNDEFINED";
};
}
@end
@implementation sendSms
+ (void)initialize
{
[[USGlobals sharedInstance].wsdlStandardNamespaces setObject:@"xsd" forKey:@"http://www.w3.org/2001/XMLSchema"%5D;
[[USGlobals sharedInstance].wsdlStandardNamespaces setObject:@"sendSms" forKey:@"http://FreebieSMS.co.uk"%5D;
}
+ (sendSmsSoap *)sendSmsSoap
{
return [[[sendSmsSoap alloc] initWithAddress:@"http://www.freebiesms.co.uk/sendsms.asmx"%5D autorelease];
}
+ (sendSmsSoap12 *)sendSmsSoap12
{
return [[[sendSmsSoap12 alloc] initWithAddress:@"http://www.freebiesms.co.uk/sendsms.asmx"%5D autorelease];
}
@end
@implementation sendSmsSoap
@synthesize address;
@synthesize logXMLInOut;
– (id)init
{
if((self = [super init])) {
address = nil;
cookies = nil;
logXMLInOut = NO;
}
return self;
}
– (id)initWithAddress:(NSString *)anAddress
{
if((self = [self init])) {
self.address = [NSURL URLWithString:anAddress];
}
return self;
}
– (void)addCookie:(NSHTTPCookie *)toAdd
{
if(toAdd != nil) {
if(cookies == nil) cookies = [[NSMutableArray alloc] init];
[cookies addObject:toAdd];
}
}
– (sendSmsSoapResponse *)SendSmsUsingParameters:(sendSms_SendSms *)aParameters
{
sendSmsSoap_SendSms *operation = [(sendSmsSoap_SendSms*)[sendSmsSoap_SendSms alloc] initWithBinding:self
parameters:aParameters
];
NSOperationQueue *queue = [[NSOperationQueue new] autorelease];
[queue addOperation:operation];
[queue waitUntilAllOperationsAreFinished];
return operation.response;
}
– (NSString *)sendHTTPCallUsingBody:(NSString *)outputBody soapAction:(NSString *)soapAction
{
NSMutableDictionary *HTTPHeaders = [NSMutableDictionary dictionary];
if(cookies != nil) {
NSDictionary *fCookies = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies];
[HTTPHeaders addEntriesFromDictionary:fCookies];
}
[HTTPHeaders setObject:@"http://www.freebiesms.co.uk/sendsms.asmx HTTP/1.1" forKey:@"POST"];
[HTTPHeaders setObject:@"text/xml;charset=UTF-8" forKey:@"Content-Type"];
[HTTPHeaders setObject:soapAction forKey:@"SOAPAction"];
[HTTPHeaders setObject:@"wsdl2objc" forKey:@"User-Agent"];
[HTTPHeaders setObject:@"www.freebiesms.co.uk" forKey:@"Host"];
[HTTPHeaders setObject:@"641" forKey:@"Content-Length"];
CFHTTPMessageRef request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, (CFStringRef)@"POST", (CFURLRef)self.address, kCFHTTPVersion1_1);
CFDataRef bodyData = (CFDataRef)[outputBody dataUsingEncoding:NSUTF8StringEncoding];
CFHTTPMessageSetBody(request, bodyData);
for(NSString *key in [HTTPHeaders allKeys]) {
CFHTTPMessageSetHeaderFieldValue(request, (CFStringRef)key, (CFStringRef)[HTTPHeaders objectForKey:key]);
}
NSDictionary *outputHeaders = (NSDictionary*)CFHTTPMessageCopyAllHeaderFields(request);
if(self.logXMLInOut) {
NSLog(@"OutputHeaders:n%@", outputHeaders);
NSLog(@"OutputBody:n%@", outputBody);
}
CFReadStreamRef readStream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request);
if(!CFReadStreamOpen(readStream)) {
CFStreamError myErr = CFReadStreamGetError(readStream);
// An error has occurred.
if (myErr.domain == kCFStreamErrorDomainPOSIX) {
// Interpret myErr.error as a UNIX errno.
} else if (myErr.domain == kCFStreamErrorDomainMacOSStatus) {
// Interpret myErr.error as a MacOS error code.
//OSStatus macError = (OSStatus)myErr.error;
// Check other error domains.
}
}
CFReadStreamSetProperty(readStream, kCFStreamPropertyHTTPShouldAutoredirect, kCFBooleanTrue);
//CFHTTPMessageRef resp = (CFHTTPMessageRef)CFReadStreamCopyProperty(readStream, kCFStreamPropertyHTTPResponseHeader);
//NSString *statusLine = (NSString*)CFHTTPMessageCopyResponseStatusLine(resp);
//NSLog(@"status line %@",statusLine );
NSMutableString *responseBody = [NSMutableString string];
static unsigned int kReadBufSize = 1024;
CFIndex numBytesRead;
do {
UInt8 buf[kReadBufSize];
numBytesRead = CFReadStreamRead(readStream, buf, sizeof(buf));
if( numBytesRead > 0 ) {
[responseBody appendString:[[[NSString alloc] initWithBytes:buf length:numBytesRead encoding:NSUTF8StringEncoding] autorelease]];
} else if( numBytesRead < 0 ) {
CFStreamError error = CFReadStreamGetError(readStream);
//[[NSApplication sharedApplication] presentError:(NSError*)error];
NSLog(@"error %@", error);
}
//} while( numBytesRead > 0 );
sleep(1);
NSLog(@" rebelotte");
} while( numBytesRead < 1 );
CFHTTPMessageRef response = (CFHTTPMessageRef)CFReadStreamCopyProperty(readStream, kCFStreamPropertyHTTPResponseHeader);
NSDictionary *responseHeaders = (NSDictionary*)CFHTTPMessageCopyAllHeaderFields(response);
[responseHeaders autorelease];
if(cookies) [cookies release];
cookies = [[NSHTTPCookie cookiesWithResponseHeaderFields:responseHeaders forURL:self.address] mutableCopy];
if(self.logXMLInOut) {
NSLog(@"ResponseHeaders:n%@", responseHeaders);
NSLog(@"ResponseBody:n%@", responseBody);
}
return responseBody;
}
@end
@implementation sendSmsSoap_SendSms
@synthesize binding;
@synthesize response;
@synthesize parameters;
– (id)initWithBinding:(sendSmsSoap *)aBinding
parameters:(sendSms_SendSms *)aParameters
{
if((self = [super init])) {
response = nil;
self.binding = aBinding;
self.parameters = aParameters;
}
return self;
}
– (void)dealloc
{
if(binding != nil) [binding release];
if(parameters != nil) [parameters release];
[super dealloc];
}
– (void)main
{
[response autorelease];
response = [sendSmsSoapResponse new];
sendSmsSoap_envelope *envelope = [sendSmsSoap_envelope sharedInstance];
NSMutableDictionary *headerElements = nil;
headerElements = [NSMutableDictionary dictionary];
NSMutableDictionary *bodyElements = nil;
bodyElements = [NSMutableDictionary dictionary];
if(parameters != nil) [bodyElements setObject:parameters forKey:@"SendSms"];
NSString *operationXMLString = [envelope serializedFormUsingHeaderElements:headerElements bodyElements:bodyElements];
NSLog(@" operationXMLString %@", operationXMLString);
NSString *responseBody = [binding sendHTTPCallUsingBody:operationXMLString soapAction:@"http://FreebieSMS.co.uk/SendSms"%5D;
NSLog(@" sendSmsSoap_SendSms main responseBody %@", responseBody);
xmlDocPtr doc;
xmlNodePtr cur;
const char *buffer = [responseBody cStringUsingEncoding:NSUTF8StringEncoding];
doc = xmlParseMemory(buffer, [responseBody length]);
NSAssert(doc != NULL, @"Errors while parsing returned XML");
cur = xmlDocGetRootElement(doc);
cur = cur->children;
for( ; cur != NULL ; cur = cur->next) {
if(cur->type == XML_ELEMENT_NODE) {
if(xmlStrEqual(cur->name, (const xmlChar *) "Body")) {
NSMutableArray *responseBodyParts = [NSMutableArray array];
xmlNodePtr bodyNode;
for(bodyNode=cur->children ; bodyNode != NULL ; bodyNode = bodyNode->next) {
if(cur->type == XML_ELEMENT_NODE) {
if(xmlStrEqual(bodyNode->name, (const xmlChar *) "SendSmsResponse") || xmlStrEqual(bodyNode->name, (const xmlChar *) "Fault") ) {
sendSms_SendSmsResponse *bodyObject = [sendSms_SendSmsResponse deserializeNode:bodyNode];
NSAssert1(bodyObject != nil, @"Errors while parsing body %s", bodyNode->name);
[responseBodyParts addObject:bodyObject];
} else {
NSLog(@" xml str no SendSmsResponse nor Fault %s", bodyNode->name );
}
}
}
response.bodyParts = responseBodyParts;
}
}
}
xmlFreeDoc(doc);
xmlCleanupParser();
}
@end
static sendSmsSoap_envelope *sendSmsSoapSharedEnvelopeInstance = nil;
@implementation sendSmsSoap_envelope
+ (sendSmsSoap_envelope *)sharedInstance
{
if(sendSmsSoapSharedEnvelopeInstance == nil) {
sendSmsSoapSharedEnvelopeInstance = [sendSmsSoap_envelope new];
}
return sendSmsSoapSharedEnvelopeInstance;
}
– (NSString *)serializedFormUsingHeaderElements:(NSDictionary *)headerElements bodyElements:(NSDictionary *)bodyElements
{
NSMutableString *serializedForm = [NSMutableString string];
[serializedForm appendFormat:@"<?xml version="1.0" encoding="utf-8"?>n"];
[serializedForm appendFormat:@"<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"n"%5D;
[serializedForm appendFormat:@"xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0"n"];
[serializedForm appendFormat:@"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"n"%5D;
[serializedForm appendFormat:@"xmlns:xsd="http://www.w3.org/2001/XMLSchema"n"%5D;
[serializedForm appendFormat:@"xmlns:sendSms="http://FreebieSMS.co.uk""%5D;
[serializedForm appendFormat:@">n"];
if(headerElements != nil) {
[serializedForm appendFormat:@"<soap:Header>n"];
for(NSString *key in [headerElements allKeys]) {
id header = [headerElements objectForKey:key];
NSString *elementName = [NSString stringWithFormat:@"%@:%@", [header nsPrefix], key];
[serializedForm appendFormat:@"%@n", [header serializedFormUsingElementName:elementName]];
}
[serializedForm appendFormat:@"</soap:Header>"];
}
if(bodyElements != nil) {
[serializedForm appendFormat:@"<soap:Body>n"];
for(NSString *key in [bodyElements allKeys]) {
id body = [bodyElements objectForKey:key];
NSString *elementName = [NSString stringWithFormat:@"%@:%@", [body nsPrefix], key];
[serializedForm appendFormat:@"%@n", [body serializedFormUsingElementName:elementName]];
}
[serializedForm appendFormat:@"</soap:Body>n"];
}
[serializedForm appendFormat:@"</soap:Envelope>"];
return serializedForm;
}
@end
@implementation sendSmsSoapResponse
@synthesize headers;
@synthesize bodyParts;
– (id)init
{
if((self = [super init])) {
headers = nil;
bodyParts = nil;
}
return self;
}
@end
@implementation sendSmsSoap12
@synthesize address;
@synthesize logXMLInOut;
– (id)init
{
if((self = [super init])) {
address = nil;
cookies = nil;
logXMLInOut = NO;
}
return self;
}
– (id)initWithAddress:(NSString *)anAddress
{
if((self = [self init])) {
self.address = [NSURL URLWithString:anAddress];
}
return self;
}
– (void)addCookie:(NSHTTPCookie *)toAdd
{
if(toAdd != nil) {
if(cookies == nil) cookies = [[NSMutableArray alloc] init];
[cookies addObject:toAdd];
}
}
– (sendSmsSoap12Response *)SendSmsUsingParameters:(sendSms_SendSms *)aParameters
{
sendSmsSoap12_SendSms *operation = [(sendSmsSoap12_SendSms*)[sendSmsSoap12_SendSms alloc] initWithBinding:self
parameters:aParameters
];
NSOperationQueue *queue = [[NSOperationQueue new] autorelease];
[queue addOperation:operation];
[queue waitUntilAllOperationsAreFinished];
return operation.response;
}
– (NSString *)sendHTTPCallUsingBody:(NSString *)outputBody soapAction:(NSString *)soapAction
{
NSMutableDictionary *HTTPHeaders = [NSMutableDictionary dictionary];
if(cookies != nil) {
NSDictionary *fCookies = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies];
[HTTPHeaders addEntriesFromDictionary:fCookies];
}
[HTTPHeaders setObject:@"wsdl2objc" forKey:@"UserAgent"];
[HTTPHeaders setObject:soapAction forKey:@"SOAPAction"];
CFHTTPMessageRef request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, (CFStringRef)@"POST", (CFURLRef)self.address, kCFHTTPVersion1_1);
CFDataRef bodyData = (CFDataRef)[outputBody dataUsingEncoding:NSUTF8StringEncoding];
CFHTTPMessageSetBody(request, bodyData);
for(NSString *key in [HTTPHeaders allKeys]) {
CFHTTPMessageSetHeaderFieldValue(request, (CFStringRef)key, (CFStringRef)[HTTPHeaders objectForKey:key]);
}
NSDictionary *outputHeaders = (NSDictionary*)CFHTTPMessageCopyAllHeaderFields(request);
if(self.logXMLInOut) {
NSLog(@"OutputHeaders:n%@", outputHeaders);
NSLog(@"OutputBody:n%@", outputBody);
}
CFReadStreamRef readStream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request);
if(!CFReadStreamOpen(readStream)) {
CFStreamError myErr = CFReadStreamGetError(readStream);
// An error has occurred.
if (myErr.domain == kCFStreamErrorDomainPOSIX) {
// Interpret myErr.error as a UNIX errno.
} else if (myErr.domain == kCFStreamErrorDomainMacOSStatus) {
// Interpret myErr.error as a MacOS error code.
//OSStatus macError = (OSStatus)myErr.error;
// Check other error domains.
}
}
CFReadStreamSetProperty(readStream, kCFStreamPropertyHTTPShouldAutoredirect, kCFBooleanTrue);
//CFHTTPMessageRef response = (CFHTTPMessageRef)CFReadStreamCopyProperty(readStream, kCFStreamPropertyHTTPResponseHeader);
//NSString *statusLine = (NSString*)CFHTTPMessageCopyResponseStatusLine(response);
NSMutableString *responseBody = [NSMutableString string];
static unsigned int kReadBufSize = 1024;
CFIndex numBytesRead;
do {
UInt8 buf[kReadBufSize];
numBytesRead = CFReadStreamRead(readStream, buf, sizeof(buf));
if( numBytesRead > 0 ) {
[responseBody appendString:[[[NSString alloc] initWithBytes:buf length:numBytesRead encoding:NSUTF8StringEncoding] autorelease]];
} else if( numBytesRead < 0 ) {
//CFStreamError error = CFReadStreamGetError(readStream);
//[[NSApplication sharedApplication] presentError:(NSError*)error];
}
} while( numBytesRead > 0 );
CFHTTPMessageRef response = (CFHTTPMessageRef)CFReadStreamCopyProperty(readStream, kCFStreamPropertyHTTPResponseHeader);
NSDictionary *responseHeaders = (NSDictionary*)CFHTTPMessageCopyAllHeaderFields(response);
[responseHeaders autorelease];
if(cookies) [cookies release];
cookies = [[NSHTTPCookie cookiesWithResponseHeaderFields:responseHeaders forURL:self.address] mutableCopy];
if(self.logXMLInOut) {
NSLog(@"ResponseHeaders:n%@", responseHeaders);
NSLog(@"ResponseBody:n%@", responseBody);
}
return responseBody;
}
@end
@implementation sendSmsSoap12_SendSms
@synthesize binding;
@synthesize response;
@synthesize parameters;
– (id)initWithBinding:(sendSmsSoap12 *)aBinding
parameters:(sendSms_SendSms *)aParameters
{
if((self = [super init])) {
response = nil;
self.binding = aBinding;
self.parameters = aParameters;
}
return self;
}
– (void)dealloc
{
if(binding != nil) [binding release];
if(parameters != nil) [parameters release];
[super dealloc];
}
– (void)main
{
[response autorelease];
response = [sendSmsSoap12Response new];
sendSmsSoap12_envelope *envelope = [sendSmsSoap12_envelope sharedInstance];
NSMutableDictionary *headerElements = nil;
headerElements = [NSMutableDictionary dictionary];
NSMutableDictionary *bodyElements = nil;
bodyElements = [NSMutableDictionary dictionary];
if(parameters != nil) [bodyElements setObject:parameters forKey:@"SendSms"];
NSString *operationXMLString = [envelope serializedFormUsingHeaderElements:headerElements bodyElements:bodyElements];
NSString *responseBody = [binding sendHTTPCallUsingBody:operationXMLString soapAction:@"http://FreebieSMS.co.uk/SendSms"%5D;
xmlDocPtr doc;
xmlNodePtr cur;
const char *buffer = [responseBody cStringUsingEncoding:NSUTF8StringEncoding];
doc = xmlParseMemory(buffer, [responseBody length]);
NSAssert(doc != NULL, @"Errors while parsing returned XML");
cur = xmlDocGetRootElement(doc);
cur = cur->children;
for( ; cur != NULL ; cur = cur->next) {
if(cur->type == XML_ELEMENT_NODE) {
if(xmlStrEqual(cur->name, (const xmlChar *) "Body")) {
NSMutableArray *responseBodyParts = [NSMutableArray array];
xmlNodePtr bodyNode;
for(bodyNode=cur->children ; bodyNode != NULL ; bodyNode = bodyNode->next) {
if(cur->type == XML_ELEMENT_NODE) {
if(xmlStrEqual(bodyNode->name, (const xmlChar *) "SendSmsResponse")) {
sendSms_SendSmsResponse *bodyObject = [sendSms_SendSmsResponse deserializeNode:bodyNode];
NSAssert1(bodyObject != nil, @"Errors while parsing body %s", bodyNode->name);
[responseBodyParts addObject:bodyObject];
}
}
}
response.bodyParts = responseBodyParts;
}
}
}
xmlFreeDoc(doc);
xmlCleanupParser();
}
@end
static sendSmsSoap12_envelope *sendSmsSoap12SharedEnvelopeInstance = nil;
@implementation sendSmsSoap12_envelope
+ (sendSmsSoap12_envelope *)sharedInstance
{
if(sendSmsSoap12SharedEnvelopeInstance == nil) {
sendSmsSoap12SharedEnvelopeInstance = [sendSmsSoap12_envelope new];
}
return sendSmsSoap12SharedEnvelopeInstance;
}
– (NSString *)serializedFormUsingHeaderElements:(NSDictionary *)headerElements bodyElements:(NSDictionary *)bodyElements
{
NSMutableString *serializedForm = [NSMutableString string];
[serializedForm appendFormat:@"<?xml version="1.0" encoding="utf-8"?>n"];
[serializedForm appendFormat:@"<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"n"%5D;
[serializedForm appendFormat:@"xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0"n"];
[serializedForm appendFormat:@"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"n"%5D;
[serializedForm appendFormat:@"xmlns:xsd="http://www.w3.org/2001/XMLSchema"n"%5D;
[serializedForm appendFormat:@"xmlns:sendSms="http://FreebieSMS.co.uk"n"%5D;
[serializedForm appendFormat:@">n"];
if(headerElements != nil) {
[serializedForm appendFormat:@"<soap:Header>n"];
for(NSString *key in [headerElements allKeys]) {
id header = [headerElements objectForKey:key];
NSString *elementName = [NSString stringWithFormat:@"%@:%@", [header nsPrefix], key];
[serializedForm appendFormat:@"%@n", [header serializedFormUsingElementName:elementName]];
}
[serializedForm appendFormat:@"</soap:Header>"];
}
if(bodyElements != nil) {
[serializedForm appendFormat:@"<soap:Body>n"];
for(NSString *key in [bodyElements allKeys]) {
id body = [bodyElements objectForKey:key];
NSString *elementName = [NSString stringWithFormat:@"%@:%@", [body nsPrefix], key];
[serializedForm appendFormat:@"%@n", [body serializedFormUsingElementName:elementName]];
}
[serializedForm appendFormat:@"</soap:Body>n"];
}
[serializedForm appendFormat:@"</soap:Envelope>"];
return serializedForm;
}
@end
@implementation sendSmsSoap12Response
@synthesize headers;
@synthesize bodyParts;
– (id)init
{
if((self = [super init])) {
headers = nil;
bodyParts = nil;
}
return self;
}
@end
“Hello World” Blackberry App
I read in this month’s VSJ that Blackberry are launching a IPhone-esque Appstore called "Blackberry Appworld", So, I went and created a developer account at Blackberry.com, and downloaded the VS2008 plugin.
I dropped on a button and label onto the form, and clicked the button, and added the code:
function Form1_btnSayMyName_Click()
{
Dialog.display("hello world");
}
I ran the project, and then I can now click on the button, and it says "Hello World".
Now, that’s the short version,
The long version, is that I had to reboot my computer twice, disable my anti-virus, and anti-worm protection, switch to the 8100 emulator, rather than the default, and generally trawl through unhelpful debug information such as this gem:
Access violation reading from 0x00000008