I am trying to use the wsdl2ws tool to write a C++ client for a web
service that I have implemented using Java Axis. I am using Axis-C++
v1.6 and Java Axis v1.2.
When making a call using the wsdl2ws generated code, the SOAP envelope
sent is, for example,
|<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
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">
<SOAP-ENV:Body>
<ns1:getUser xmlns:ns1="http://cityxpress.com/external">
<ns1:siteinfo>
<ns1:partner>cityxpress</ns1:partner>
<ns1:deployment>master</ns1:deployment>
<ns1:site>new_demo</ns1:site>
</ns1:siteinfo>
<ns1:id>123456</ns1:id>
</ns1:getUser>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
|
This is fine but I need to add a header to the envelope so I subclassed
the stub and added the following to the constructor:
| IHeaderBlock *phb = this->createSOAPHeaderBlock("authinfo",
"http://cityxpress.com/external", "ai");
BasicNode *el_node = phb->createChild(ELEMENT_NODE, "user", NULL,
"http://cityxpress.com/external", NULL);
BasicNode *t_node = phb->createChild(CHARACTER_NODE);
t_node->setValue(user);
el_node->addChild(t_node);
phb->addChild(el_node);
el_node = phb->createChild(ELEMENT_NODE, "password", NULL,
"http://cityxpress.com/external", NULL);
t_node = phb->createChild(CHARACTER_NODE);
t_node->setValue(pass);
el_node->addChild(t_node);
phb->addChild(el_node);
|
Now, when I make the call to the service, the SOAP envelope is
|<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
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">
<SOAP-ENV:Header>
<ai:authinfo xmlns:ai="http://cityxpress.com/external">
<ai:user>username</ai:user>
<ai:password>password</ai:password>
</ai:authinfo></SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:getUser xmlns:ns1="http://cityxpress.com/external">
<ns1:siteinfo>
<partner>cityxpress</partner>
<deployment>master</deployment>
<site>new_demo</site>
</ns1:siteinfo>
<ns1:id>123456</ns1:id>
</ns1:getUser>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
|
Note that the partner, deployment and site subelements of siteinfo have
lost their namespace prefix. This means that the web service ignores
the values given because the elements are not in the expected namespace.
For the sake of comparison, here is the envelope created by a Java
version of the client created with WSDL2Java which is understood by the
web service:
|<?xml version="1.0" encoding="UTF-8"?>
<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:Header>
<ns1:authinfo
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns:ns1="http://cityxpress.com/external">
<ns1:user>username</ns1:user>
<ns1:password>password</ns1:password>
</ns1:authinfo>
</soapenv:Header>
<soapenv:Body>
<getUser xmlns="http://cityxpress.com/external">
<siteinfo>
<partner>cityxpress</partner>
<deployment>master</deployment>
<site>new_demo</site>
</siteinfo>
<id>123456</id>
</getUser>
</soapenv:Body>
</soapenv:Envelope>
|The obvious question is how do I get the C++ client to generate a SOAP
Envelope that is comparable to the one created by the Java client?
As an aside, I wanted to try a C client to see if the same problem
existed but, though wsdl2ws will generate C-code, there don't seem to be
any C libraries that I can link to. Are C libraries missing or is there
a way that I can link C code to the C++ libraries?
Thanks,
Dan.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]