Re: Web Services
Re: Web Services
- Subject: Re: Web Services
- From: Fred McCann <email@hidden>
- Date: Tue, 15 Mar 2005 06:59:03 -0800 (PST)
So I
tinkered around some more and I got some data flowing between axis and
core web services. The catch is you need to use Axis 1.1 and not 1.2.
The xml that 1.2 outputs breaks core web services. Even using Axis 1.1,
I still can't convince Core Web Services to send certain types, such as
longs. In short it appears that you can use Core Web Services to talk
to java middleware, there are just some gotchas. While I finally got
something working, Core Web Services is pretty fragile. I hope Apple
works on their SOAP implementation in the future.
- Fred
From: Benjamin Levy <email@hidden>
Date: Mon, 14 Mar 2005 18:50:10 -0500
To: email@hidden
Cc: email@hidden
Subject: Re: Web Services
Your WSDL looks about the same as mine except I don't ever use
xsd:dateTime and all of my ints are xsd:int and not soapenc:int.
The response from Axis I looks a little bit different. This is a
result with an array of a complex datatype -
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:ppcGetSyncActionsResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://soap.my.service">
<ns1:ppcGetSyncActionsReturn xsi:type="soapenc:Array"
soapenc:arrayType="ns2:ppcSync[1]"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="urn:myservice">
<item href=""/>
</ns1:ppcGetSyncActionsReturn>
</ns1:ppcGetSyncActionsResponse>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:ppcSync"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns3="urn:myservice">
<action xsi:type="xsd:int">0</action>
<name xsi:type="xsd:string">name</name>
<path xsi:type="xsd:string">path</path>
<size xsi:type="xsd:int">0</size>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
I set up each call with something like this (this is not the call the
generates the above response) -
ppcGetID* getID = [[ppcGetID alloc] init];
[getID setParameters:authInfo
in_shared:NO];
[getID setCallBack:self
selector:@selector(getIDCompleted:)];
[getID scheduleOnRunLoop:(NSRunLoop*)
CFRunLoopGetCurrent() mode: (NSString*) kCFRunLoopDefaultMode];
And then my callback looks something like this -
- (void)getIDCompleted:(ppcGetID*)getID
{
if ([getID isFault]) {
NSMutableString* faultString = [[NSMutableString alloc]
initWithString:[getID faultString]];
[faultString
replaceOccurrencesOfString:@"java.rmi.RemoteException: " withString:@""
options:NSAnchoredSearch range:NSMakeRange( 0, [faultString
length] )];
[statusField setStringValue:[NSString stringWithFormat:@"Error
getting account information
%@", faultString]];
[getID release];
[faultString release];
// ... more here ...
} else {
NSDictionary* result = [[getID resultValue] retain];
[getID release];
[statusField setStringValue:@""];
NSString* value1 = [result objectForKey:@"value1"];
// ... etc ...
[ppcReg release];
// ... more here ...
}
}
On Mar 14, 2005, at 4:42 PM, Fred McCann wrote:
> I could get over using NSDictionaries. It's not perfect but it should
> work. The problems I'm seeing with Core Web Services is that it's not
> even getting the dictionaries right.
>
>
> For example, I made a simple java bean and exposed it with Apache
> Axis:
>
> <complexType name="Widget">
> <sequence>
> <element name="code" nillable="true" type="soapenc:string"/>
> <element name="color" nillable="true" type="soapenc:string"/>
> <element name="count" type="xsd:int"/>
> <element name="date" nillable="true" type="xsd:dateTime"/>
> <element name="description" nillable="true"
> type="soapenc:string"/>
> <element name="name" nillable="true" type="soapenc:string"/>
> <element name="serial" nillable="true" type="soapenc:int"/>
> </sequence>
> </complexType>
>
> When the application makes a response for a specific Widget, it gets
> this:
>
> HTTP/1.1 200 OK
> Content-Type: text/xml;charset=utf-8
> Date: Fri, 11 Mar 2005 23:59:16 GMT
> Server: Apache-Coyote/1.1
> Connection: close
>
> <soapenv:envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="">
> <soapenv:body>
> <ns1:loadresponse
> soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns1="">
> <loadreturn href="" />
> </ns1:loadresponse>
> <multiref id="id0" soapenc:root="0"
> soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="ns2:Widget"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns2="urn:wstest">
> <code xsi:type="soapenc:string">
> WI2314</code>
> <color xsi:type="soapenc:string">
> blue
> </color>
> <count href="" />
> <date xsi:type="xsd:dateTime">
> 2004-12-12T05:00:00.000Z
> </date>
> <description xsi:type="soapenc:string">
> Foo barr
> </description>
> <name xsi:type="soapenc:string">
> Tape Recorder
> </name>
> <serial href="" />
> </multiref>
> <multiref id="id2" soapenc:root="0"
> soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="soapenc:int"
> xmlns:soapenc="">
> 56
> </multiref>
> <multiref id="id1" soapenc:root="0"
> soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="xsd:int"
> xmlns:soapenc="">
> 12
> </multiref>
> </soapenv:body>
> </soapenv:envelope>
>
>
> The NSDictionary that I get back from Core Webservices has nil values
> for all the int types. I have no clue what to do about that. Also, I
> had issues in another test attempting to send long types. How are you
> getting dictionaries?
>
>
---
Ben Levy :: Technology Development Manager, GoKnow, Inc.
direct line - 734.929.6605 :: http://www.goknow.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden