Problem implementing an axis2 client

43 views
Skip to first unread message

Markus Becker

unread,
Jan 4, 2011, 5:11:47 AM1/4/11
to wst-...@googlegroups.com
Dear Inoussa,

thank you for your great work!

i'm trying to implement a client for an existing axis2 web service. i have a working java implementation and work on a delphi 6 implementation but found it easier to use lazarus for getting started.
i did the following
* installed lazarus, synapse and wst (from svn)
* used ws_helper to generate the support pascal files
* wrote a small program to call the service
Unfortunately at this point i got stuck a little bit, any help would be greatly appreciated :)
* i keep getting an error from the service like

<?xml version='1.0' encoding='UTF-8'?><soapenv:
Envelope xmlns:soapenv="http://sc
hemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapen
v:Server</faultcode><faultstring>org.apache.axis2.databinding.ADBException: Unex
pected subelement cientID</faultstring><detail /></soapenv:Fault></soapenv:Body>
</soapenv:Envelope>

after some debugging and comparing against the java implementation i found the following:

JAVA
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns1:trafficMapQuery xmlns:ns1="http:...theAddress...">
<cientID>...theID...</cientID><pwd>...thePassword...</pwd>
</ns1:trafficMapQuery></soapenv:Body></soapenv:Envelope>

this is the way the java implementation initially calls the server. The answer is fine.

WST
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body xmlns:ns1="http:...theAddress...">
    <ns1:trafficMapQuery>
      <ns1:cientID>...theID...</ns1:cientID>
      <ns1:pwd>...thePassword...</ns1:pwd>
    </ns1:trafficMapQuery>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
this is the way my pascal process calls the server - which rejects the request with the above error message.


WST-CHANGE1
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <ns1:trafficMapQuery xmlns:ns1="http:...theAddress...">
      <cientID>...theID...</cientID>
      <pwd>...thePassword...</pwd>
    </ns1:trafficMapQuery>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

WST-CHANGE2
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body xmlns:ns1="http:...theAddress...">
    <ns1:trafficMapQuery>
      <cientID>...theID...</cientID>
      <pwd>...thePassword...</pwd>
    </ns1:trafficMapQuery>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

WST-CHANGE1 and WST-CHANGE2 show versions where i manipulated the xml text just before sent out on the wire (within procedure THTTPTransport.SendAndReceive(ARequest, AResponse: TStream); )
Both versions work.

Now it seems to me, that the parameters "cientID" ( :) ) and "pwd" should not be preceeded with "ns1:".
Can you give any advice of how to fix this?

best regards
Markus


Inoussa OUEDRAOGO

unread,
Jan 4, 2011, 5:35:18 AM1/4/11
to wst-list
Hi

> Now it seems to me, that the parameters "cientID" ( :) ) and "pwd" should
> not be preceeded with "ns1:".
> Can you give any advice of how to fix this?

This depend on service being "RPC" or "Document" oriented.
Prefixing with the namespace (ns1) is done for document oriented serialization.

Can you send me the WSDL file ? (by private mail)

--
Inoussa O.

Inoussa OUEDRAOGO

unread,
Jan 4, 2011, 7:05:21 AM1/4/11
to wst-list
Please note that xml is case sensitive. In the wsdl file the client id is cased as "clientId" while in the error and the
extract request it is cased as "clientID". Verify the casing. 


--
Inoussa O.

mb16

unread,
Jan 4, 2011, 7:17:39 AM1/4/11
to WST-LIST

hmm, this seems to be a bit inconsistent set up within the service as
the field clientId/cientID exist a few times, but for the desired
function "trafficMapQuery" it is misspelled and cased cientID:

wdsl file:
...
<xsd:element name="trafficMapQuery">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="cientID"
type="xsd:string">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="1" name="pwd"
type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType></xsd:element>
....

Markus

Markus Becker

unread,
Jan 6, 2011, 11:04:51 AM1/6/11
to WST-LIST
Hi Inoussa,

well, I did some further investigations and after all I'm quite convinced that the output of wst is correct while the (axis2)
serverside seems to be quite peculiar regarding the namespace pefixes.
I will talk to the nice people running the server, maybe they can adjust something.

Anyway, again, thanks a lot for your help.

best regards
Markus

Inoussa OUEDRAOGO

unread,
Jan 7, 2011, 1:31:21 PM1/7/11
to wst-list
Hi

2011/1/6 Markus Becker <mb16....@googlemail.com>

Thank very much for the report. I think so.

I also did some investigations; XSD allows compound data structures to have some subproperties (elements) that are not namespace qualified, 
see [1] using the "form" attribute or the schema's "elementFormDefault". But that is not the case for this schema and I have not yet encouter a
schema using this form. 

[1] http://www.w3.org/TR/xmlschema-1/#declare-element
--
Inoussa O.
Reply all
Reply to author
Forward
0 new messages