Archive

Author Archive

English-Indian Locale

enIN.ldml

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"&gt;
      <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"&gt;
      <msLocale:direction type="left-to-right" />
    </special>
  </layout>
  <characters>
    <special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml"&gt;
      <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"&gt;
          <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"&gt;
            <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"&gt;
            <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"&gt;
            <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"&gt;
          <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"&gt;
        <msLocale:currencyDecimalSeparator>.</msLocale:currencyDecimalSeparator>
        <msLocale:currencyGroupSeparator>,</msLocale:currencyGroupSeparator>
      </special>
    </symbols>
    <special xmlns:msLocale="http://schemas.microsoft.com/globalization/2004/08/carib/ldml"&gt;
      <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"&gt;
          <msLocale:isoCurrency>INR</msLocale:isoCurrency>
          <msLocale:currencyEnglishName>Indian Rupee</msLocale:currencyEnglishName>
        </special>
      </currency>
    </currencies>
  </numbers>
</ldml>

Categories: Uncategorized

Email to SMS project

https://www.getafreelancer.com/projects/NET/Email-SMS.html

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.

Categories: Uncategorized

Sending SMS via Soap from Cocoa (Mac)

Here is some code that was used as part of my IPhone App for sending SMS messages via SOAP;

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&quot; 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&quot; 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

Categories: Uncategorized

“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&#4;

Categories: Uncategorized

Web services in PHP

I was recently asked if .NET webservices could be used from PHP, and the answer is they can.
Thanks to a toolkit called nusoap (http://sourceforge.net/projects/nusoap/)

I managed to get the Google Web search webservice working (client3.php)

Here’s the output:

Result

Array
(
[directoryCategories] => Array
(
)

[documentFiltering] =>
[endIndex] => 10
[estimateIsExact] =>
[estimatedTotalResultsCount] => 19300000
[resultElements] => Array
(
[0] => Array
(
[URL] => http://en.wikipedia.org/wiki/Robotics
[cachedSize] => 124k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Robotics is the science and technology of robots, and their design, manufacture,
and application. [1] Robotics has connections to electronics, mechanics, ...
[summary] =>
[title] => Robotics - Wikipedia, the free encyclopedia
)

[1] => Array
(
[URL] => http://www.thetech.org/exhibits/online/robotics/
[cachedSize] => 9k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => The history and workings of robotics. From the Tech Museum of Innovation.
[summary] =>
[title] => The Tech Museum: Robotics: Sensing, Thinking, Acting
)

[2] => Array
(
[URL] => http://www.thetech.org/robotics/
[cachedSize] => 9k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => The history and workings of robotics. From the Tech Museum of Innovation.
[summary] =>
[title] => The Tech Museum: Robotics: Sensing, Thinking, Acting
)

[3] => Array
(
[URL] => http://www.arrickrobotics.com/
[cachedSize] => 10k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Manufactures and sells mobile robots, stepper motor systems, XY positioning
tables and automation accessories. General technical information on robots.
[summary] =>
[title] => Arrick Robotics - Stepper motor, Positioning, Automation, Mobile ...
)

[4] => Array
(
[URL] => http://www.robotics.org/
[cachedSize] => 25k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Jan 27, 2009 ... Robotics Online - RIA - Robotic Industries Association ... Saint Joseph's
Launches International College of Robotic Surgery ...
[summary] =>
[title] => RIA - Robotics Online - Your #1 Online Resource for Industrial ...
)

[5] => Array
(
[URL] => http://msdn.microsoft.com/en-us/robotics/default.aspx
[cachedSize] => 37k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Microsoft Robotics Developer Studio Standard and Academic Editions have the ...
Collada Update (Jan 2009) for Microsoft Robotics Developer Studio 2008 ...
[summary] =>
[title] => Microsoft Robotics
)

[6] => Array
(
[URL] => http://www.ri.cmu.edu/
[cachedSize] => 33k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Established in 1979 to conduct basic and applied research in robotics
technologies relevant to industrial and societal tasks. Links to a range of
specific ...
[summary] =>
[title] => The Robotics Institute
)

[7] => Array
(
[URL] => http://robotics.nasa.gov/
[cachedSize] => 25k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => A NASA project dedicated to encouraging people to become involved in science and
engineering, particularly building robots. Visit this website to learn ...
[summary] =>
[title] => NASA Robotics - Robotics Alliance Project
)

[8] => Array
(
[URL] => http://robotics.jpl.nasa.gov/
[cachedSize] => 30k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => MOBILITY AND ROBOTIC SYSTEMS Richard Volpe, Manager Gabriel Udomkesmalee, Deputy
Manager.
[summary] =>
[title] => JPL Robotics: Home Page
)

[9] => Array
(
[URL] => http://www.roboticstrends.com/
[cachedSize] => 19k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => News, information, opinion and analysis portal covering the personal, service,
mobile and military robotics markets.
[summary] =>
[title] => Robotics Trends | Robots and Robotics Technology News, Information ...
)

)

[searchComments] =>
[searchQuery] => robotics
[searchTime] => 0.437665
[searchTips] =>
[startIndex] => 1
)

Request

POST /search/beta2 HTTP/1.0
Host: api.google.com
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "urn:GoogleSearch"
Content-Length: 960

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns6198:doGoogleSearch xmlns:ns6198="urn:GoogleSearch"><Googlekey xsi:type="xsd:string">s06KddJQFHI4ZF25z0a8q7P3bjSGzh74</Googlekey><queryStr xsi:type="xsd:string">robotics</queryStr><startFrom xsi:type="xsd:int">0</startFrom><maxResults xsi:type="xsd:int">10</maxResults><filter xsi:type="xsd:boolean">1</filter><restrict xsi:type="xsd:string"></restrict><adultContent xsi:type="xsd:boolean">1</adultContent><language xsi:type="xsd:string"></language><iencoding xsi:type="xsd:string"></iencoding><oendcoding xsi:type="xsd:string"></oendcoding></ns6198:doGoogleSearch></SOAP-ENV:Body></SOAP-ENV:Envelope>

Response

HTTP/1.0 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 10504
Date: Wed, 28 Jan 2009 10:50:35 GMT
Expires: Wed, 28 Jan 2009 10:50:35 GMT
Cache-Control: private, max-age=0
Server: GFE/1.3
Connection: Close

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:doGoogleSearchResponse xmlns:ns1="urn:GoogleSearch" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="ns1:GoogleSearchResult">
<directoryCategories xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Array" ns2:arrayType="ns1:DirectoryCategory[0]">
</directoryCategories>
<documentFiltering xsi:type="xsd:boolean">false</documentFiltering>
<endIndex xsi:type="xsd:int">10</endIndex>
<estimateIsExact xsi:type="xsd:boolean">false</estimateIsExact>
<estimatedTotalResultsCount xsi:type="xsd:int">19300000</estimatedTotalResultsCount>
<resultElements xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Array" ns3:arrayType="ns1:ResultElement[10]">
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://en.wikipedia.org/wiki/Robotics</URL>
<cachedSize xsi:type="xsd:string">124k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">&lt;b&gt;Robotics&lt;/b&gt; is the science and technology of &lt;b&gt;robots&lt;/b&gt;, and their design, manufacture, &lt;br&gt; and application. [1] &lt;b&gt;Robotics&lt;/b&gt; has connections to electronics, mechanics, &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">&lt;b&gt;Robotics&lt;/b&gt; - Wikipedia, the free encyclopedia</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.thetech.org/exhibits/online/robotics/</URL>
<cachedSize xsi:type="xsd:string">9k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">The history and workings of &lt;b&gt;robotics&lt;/b&gt;. From the Tech Museum of Innovation.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">The Tech Museum: &lt;b&gt;Robotics&lt;/b&gt;: Sensing, Thinking, Acting</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.thetech.org/robotics/</URL>
<cachedSize xsi:type="xsd:string">9k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">The history and workings of &lt;b&gt;robotics&lt;/b&gt;. From the Tech Museum of Innovation.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">The Tech Museum: &lt;b&gt;Robotics&lt;/b&gt;: Sensing, Thinking, Acting</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.arrickrobotics.com/</URL>
<cachedSize xsi:type="xsd:string">10k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">Manufactures and sells mobile &lt;b&gt;robots&lt;/b&gt;, stepper motor systems, XY positioning &lt;br&gt; tables and automation accessories. General technical information on &lt;b&gt;robots&lt;/b&gt;.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">Arrick &lt;b&gt;Robotics&lt;/b&gt; - Stepper motor, Positioning, Automation, Mobile &lt;b&gt;...&lt;/b&gt;</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.robotics.org/</URL>
<cachedSize xsi:type="xsd:string">25k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">Jan 27, 2009 &lt;b&gt;...&lt;/b&gt; &lt;b&gt;Robotics&lt;/b&gt; Online - RIA - &lt;b&gt;Robotic&lt;/b&gt; Industries Association &lt;b&gt;...&lt;/b&gt; Saint Joseph&amp;#39;s &lt;br&gt; Launches International College of &lt;b&gt;Robotic&lt;/b&gt; Surgery &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">RIA - &lt;b&gt;Robotics&lt;/b&gt; Online - Your #1 Online Resource for Industrial &lt;b&gt;...&lt;/b&gt;</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://msdn.microsoft.com/en-us/robotics/default.aspx</URL>
<cachedSize xsi:type="xsd:string">37k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">Microsoft &lt;b&gt;Robotics&lt;/b&gt; Developer Studio Standard and Academic Editions have the &lt;b&gt;...&lt;/b&gt; &lt;br&gt; Collada Update (Jan 2009) for Microsoft &lt;b&gt;Robotics&lt;/b&gt; Developer Studio 2008 &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">Microsoft &lt;b&gt;Robotics&lt;/b&gt;</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.ri.cmu.edu/</URL>
<cachedSize xsi:type="xsd:string">33k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">Established in 1979 to conduct basic and applied research in &lt;b&gt;robotics&lt;/b&gt; &lt;br&gt; technologies relevant to industrial and societal tasks. Links to a range of &lt;br&gt; specific &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">The &lt;b&gt;Robotics&lt;/b&gt; Institute</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://robotics.nasa.gov/</URL>
<cachedSize xsi:type="xsd:string">25k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">A NASA project dedicated to encouraging people to become involved in science and &lt;br&gt; engineering, particularly building &lt;b&gt;robots&lt;/b&gt;. Visit this website to learn &lt;b&gt;...&lt;/b&gt;</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">NASA &lt;b&gt;Robotics&lt;/b&gt; - &lt;b&gt;Robotics&lt;/b&gt; Alliance Project</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://robotics.jpl.nasa.gov/</URL>
<cachedSize xsi:type="xsd:string">30k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">MOBILITY AND &lt;b&gt;ROBOTIC&lt;/b&gt; SYSTEMS Richard Volpe, Manager Gabriel Udomkesmalee, Deputy &lt;br&gt; Manager.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">JPL &lt;b&gt;Robotics&lt;/b&gt;: Home Page</title>
</item>
<item xsi:type="ns1:ResultElement">
<URL xsi:type="xsd:string">http://www.roboticstrends.com/</URL>
<cachedSize xsi:type="xsd:string">19k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xsi:type="xsd:string"></fullViewableName>
<specialEncoding xsi:type="xsd:string"></specialEncoding>
</directoryCategory>
<directoryTitle xsi:type="xsd:string"></directoryTitle>
<hostName xsi:type="xsd:string"></hostName>
<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
<snippet xsi:type="xsd:string">News, information, opinion and analysis portal covering the personal, service, &lt;br&gt; mobile and military &lt;b&gt;robotics&lt;/b&gt; markets.</snippet>
<summary xsi:type="xsd:string"></summary>
<title xsi:type="xsd:string">&lt;b&gt;Robotics&lt;/b&gt; Trends | &lt;b&gt;Robots&lt;/b&gt; and &lt;b&gt;Robotics&lt;/b&gt; Technology News, Information &lt;b&gt;...&lt;/b&gt;</title>
</item>
</resultElements>
<searchComments xsi:type="xsd:string"></searchComments>
<searchQuery xsi:type="xsd:string">robotics</searchQuery>
<searchTime xsi:type="xsd:double">0.437665</searchTime>
<searchTips xsi:type="xsd:string"></searchTips>
<startIndex xsi:type="xsd:int">1</startIndex>
</return>
</ns1:doGoogleSearchResponse>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Debug

2009-01-28 10:50:55.359379 nusoap_client: ctor wsdl= timeout=0 response_timeout=30
endpoint=string(34) "http://api.google.com/search/beta2"
2009-01-28 10:50:55.360128 nusoap_client: instantiate SOAP with endpoint at http://api.google.com/search/beta2
2009-01-28 10:50:55.361319 nusoap_client: setUseCURL(0)
2009-01-28 10:50:55.362546 nusoap_client: call: operation=doGoogleSearch, namespace=urn:GoogleSearch, soapAction=urn:GoogleSearch, rpcParams=, style=rpc, use=encoded, endpointType=soap
params=array(10) {
["Googlekey"]=>
string(32) "s06KddJQFHI4ZF25z0a8q7P3bjSGzh74"
["queryStr"]=>
string(8) "robotics"
["startFrom"]=>
int(0)
["maxResults"]=>
int(10)
["filter"]=>
bool(true)
["restrict"]=>
string(0) ""
["adultContent"]=>
bool(true)
["language"]=>
string(0) ""
["iencoding"]=>
string(0) ""
["oendcoding"]=>
string(0) ""
}
headers=bool(false)
2009-01-28 10:50:55.363275 nusoap_client: serializing param array for operation doGoogleSearch
2009-01-28 10:50:55.364631 nusoap_client: in serialize_val: name=Googlekey, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(32) "s06KddJQFHI4ZF25z0a8q7P3bjSGzh74"
attributes=bool(false)
2009-01-28 10:50:55.365308 nusoap_client: serialize_val: serialize string
2009-01-28 10:50:55.367119 nusoap_client: serialize_val returning <Googlekey xsi:type="xsd:string">s06KddJQFHI4ZF25z0a8q7P3bjSGzh74</Googlekey>
2009-01-28 10:50:55.368314 nusoap_client: in serialize_val: name=queryStr, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(8) "robotics"
attributes=bool(false)
2009-01-28 10:50:55.368980 nusoap_client: serialize_val: serialize string
2009-01-28 10:50:55.370159 nusoap_client: serialize_val returning <queryStr xsi:type="xsd:string">robotics</queryStr>
2009-01-28 10:50:55.370744 nusoap_client: in serialize_val: name=startFrom, type=, name_ns=, type_ns=, use=encoded, soapval=
value=int(0)
attributes=bool(false)
2009-01-28 10:50:55.371388 nusoap_client: serialize_val: serialize int
2009-01-28 10:50:55.371939 nusoap_client: serialize_val returning <startFrom xsi:type="xsd:int">0</startFrom>
2009-01-28 10:50:55.373122 nusoap_client: in serialize_val: name=maxResults, type=, name_ns=, type_ns=, use=encoded, soapval=
value=int(10)
attributes=bool(false)
2009-01-28 10:50:55.373807 nusoap_client: serialize_val: serialize int
2009-01-28 10:50:55.374378 nusoap_client: serialize_val returning <maxResults xsi:type="xsd:int">10</maxResults>
2009-01-28 10:50:55.374939 nusoap_client: in serialize_val: name=filter, type=, name_ns=, type_ns=, use=encoded, soapval=
value=bool(true)
attributes=bool(false)
2009-01-28 10:50:55.375600 nusoap_client: serialize_val: serialize boolean
2009-01-28 10:50:55.376151 nusoap_client: serialize_val returning <filter xsi:type="xsd:boolean">1</filter>
2009-01-28 10:50:55.376893 nusoap_client: in serialize_val: name=restrict, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(0) ""
attributes=bool(false)
2009-01-28 10:50:55.377546 nusoap_client: serialize_val: serialize string
2009-01-28 10:50:55.378117 nusoap_client: serialize_val returning <restrict xsi:type="xsd:string"></restrict>
2009-01-28 10:50:55.378729 nusoap_client: in serialize_val: name=adultContent, type=, name_ns=, type_ns=, use=encoded, soapval=
value=bool(true)
attributes=bool(false)
2009-01-28 10:50:55.379415 nusoap_client: serialize_val: serialize boolean
2009-01-28 10:50:55.379966 nusoap_client: serialize_val returning <adultContent xsi:type="xsd:boolean">1</adultContent>
2009-01-28 10:50:55.380546 nusoap_client: in serialize_val: name=language, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(0) ""
attributes=bool(false)
2009-01-28 10:50:55.381213 nusoap_client: serialize_val: serialize string
2009-01-28 10:50:55.381785 nusoap_client: serialize_val returning <language xsi:type="xsd:string"></language>
2009-01-28 10:50:55.382395 nusoap_client: in serialize_val: name=iencoding, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(0) ""

Categories: Uncategorized

IPhone application out to tender

Categories: Uncategorized

Using Gliffy to create entity models

Categories: Uncategorized

Com Reflection

I read with interest this month’s MSDN magazine article on COM reflection.
The article provides an example of using reflection to uncover hidden
properties and methods of the Speech library, and also explains how the
elusive System.__ComObject can give up its goodies, so to speak.

It
works fine on the sample Speech API DLL on the site, however, it isn’t
so hot when it comes to Sage. I tried plugging in some common CLSID’s
from Sage’s inner workings, but it gave up no further information. I
then tried passing a System.__ComObject to it, with the following code;

Dim oUnknown As Object = o.GetCompanies("C:Program FilesSageAccounts")
DumpCOMObject(oUnknown)

However, it crashed out when IDispatch::GetTypeInfoCount returned 0. According to MSDN reference this is done to prevent run-time inspection of the DLL, perhaps for security purposes.

So,
I guess this is a bit of an anti-pattern when it comes to Sage
development, but I hope that this research saves another developer some
time when it comes to trying to figure out the million dollar question
‘what do I cast this object to now?

Categories: Uncategorized

AppAnalyze launched on SourceForge

Over the years, you develop many different components for different projects that sometimes get reused in many different ways.

After a while when you start going down one path of maybe one or two larger projects, many of the components you developed once, no longer apply.
Therefore I decided to dig into my old toolkit and publish some of the components I once relied on for my bread-and-butter development work.

The first of which is AppAnalyze, which is now released under GPL open source on sourceforge
 http://sourceforge.net/projects/appanalyze/

I hope this provides as much benefit to you as it did for me.

Categories: Uncategorized

Firing an onchange event from a HTMLSelectElement

Something I just solved, which alot of people seemed to be stuggling with, is the ability to fire the onchange method of a select
box programatically from .NET (in this case VB.NET)
 
Basically the problem is, if you have a drop down list, stored in a HTMLSelectElement, and you set the selectedIndex propery, the onchange event doesn’t automatically get called. – the same happens in Javascript – but you can’t call onchange() like in Javascript, since it’s a property, not a method.
 
Solution
 
hse.FireEvent("onchange", hse.onchange)
 
where hse is the HTMLSelectelement
 
 
Categories: Uncategorized