|
| Problem with my client NuSOAP to send parameters to a WS | |
Joined: 23 Nov 2007 |
Posts: 3 |
|
|
|
Posted: Thu Nov 22, 2007 1:44 pm |
|
|
|
|
|
Hello,
I have a problem with my client NuSOAP to send parameters to a WS
Here my WSDL :
<definitions targetNamespace="http://mycompany.fr/mysystem/xmlio/">
<!--
WSDL created by Apache Axis version: 1.3
Built on Oct 05, 2005 (05:23:37 EDT)
-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://mycompany.fr/mysystem/xmlio/">
<complexType name="XmlIoHeaderType">
<sequence>
<element maxOccurs="1" minOccurs="0" name="SecurityId" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="SecurityToken" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="ProcessId" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="ParentId" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="XmlIoRequest">
<sequence>
<element name="XmlIoHeader" nillable="true" type="impl:XmlIoHeaderType"/>
<element name="ClassName" nillable="true" type="xsd:string"/>
<element name="OperationName" nillable="true" type="xsd:string"/>
<element name="XmlIoCurrentUrl" nillable="true" type="xsd:string"/>
<element name="XmlIoFinalUrl" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="XmlIn" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="XsdIn" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="XmlIoRequest" type="impl:XmlIoRequest"/>
<complexType name="XmlIoErrorType">
<sequence>
<element name="ClassName" nillable="true" type="xsd:string"/>
<element name="Message" nillable="true" type="xsd:string"/>
<element maxOccurs="unbounded" minOccurs="0" name="StackElement" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="XmlIoResponse">
<sequence>
<element name="XmlIoHeader" nillable="true" type="impl:XmlIoHeaderType"/>
<element maxOccurs="1" minOccurs="0" name="XmlOut" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="XsdOut" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="XmlIoError" nillable="true" type="impl:XmlIoErrorType"/>
</sequence>
</complexType>
<element name="XmlIoResponse" type="impl:XmlIoResponse"/>
</schema>
</wsdl:types>
<message name="xmlIoOperationRequest">
<part element="impl:XmlIoRequest" name="XmlIoRequest"/>
</message>
<message name="xmlIoOperationResponse">
<part element="impl:XmlIoResponse" name="XmlIoResponse"/>
</message>
<portType name="XmlIoPortType">
<operation name="xmlIoOperation" parameterOrder="XmlIoRequest">
<input message="impl:xmlIoOperationRequest" name="xmlIoOperationRequest"/>
<output message="impl:xmlIoOperationResponse" name="xmlIoOperationResponse"/>
</operation>
</portType>
<binding name="XmlIoPortTypeSoapBinding" type="impl:XmlIoPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="xmlIoOperation">
<wsdlsoap:operation soapAction=""/>
<input name="xmlIoOperationRequest">
<wsdlsoap:body use="literal"/>
</input>
<output name="xmlIoOperationResponse">
<wsdlsoap:body use="literal"/>
</output>
</operation>
</binding>
<service name="XmlIoService">
<port binding="impl:XmlIoPortTypeSoapBinding" name="XmlIoPortType">
<wsdlsoap:address location="http://myserver.mycompany.fr:7777/mysystemws/services/XmlIoPortType"/>
</port>
</service>
</definitions> |
Here is my PHP NuSOAP client :
$proxyhost = '';
$proxyport = '';
$proxyusername = '';
$proxypassword = '';
$client = new soapclient('http://myserver.mycompany.fr:7777/mysystemws/services/XmlIoPortType', true,
$proxyhost, $proxyport, $proxyusername, $proxypassword);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
$xmlioheader = array( 'SecurityId' => 'mylogin',
'SecurityToken' => '00',
'ProcessId' => '',
'ParentId' => '');
$param = array( 'XmlIoHeader' => $xmlioheader,
'ClassName' => 'fr.mycompany.mysystem.outilsws.securite.SecWs',
'OperationName' => 'allocateSgc',
'XmlIoCurrentUrl' => '',
'XmlIoFinalUrl' => '',
'XmlIn' => '',
'XsdIn' => ''
);
//$namespace = 'XmlIoPortType';
$result = $client->call('xmlIoOperation', $param);
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; |
And here is the error :
Constructor error
wsdl error: XML error parsing WSDL from http://myserver.mycompany.fr:7777/mysystemws/services/XmlIoPortType on line 2: junk after document element
Fault
Array
(
[faultcode] => soapenv:Server.userException
[faultstring] => org.xml.sax.SAXException: Invalid element in fr.mycompany.mysystem.outilssvc.xmlio_soap.XmlIoRequest - XmlIoHeader
[detail] => Array
(
[hostname] => myserver.mycompany.fr
)
)
Request
POST /mysystemws/services/XmlIoPortType HTTP/1.0
Host: myserver.mycompany.fr:7777
User-Agent: NuSOAP/0.7.2 (1.94)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 1033
<?xml version="1.0" encoding="ISO-8859-1"?><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><ns8471:xmlIoOperation xmlns:ns8471="http://tempuri_org"><XmlIoHeader><SecurityId xsi:type="xsd:string">mylogin</SecurityId><SecurityToken xsi:type="xsd:string">00</SecurityToken><ProcessId xsi:type="xsd:string"></ProcessId><ParentId xsi:type="xsd:string"></ParentId></XmlIoHeader><ClassName xsi:type="xsd:string">fr.mycompany.mysystem.outilsws.securite.SecWs</ClassName><OperationName xsi:type="xsd:string">allocateSgc</OperationName><XmlIoCurrentUrl xsi:type="xsd:string"></XmlIoCurrentUrl><XmlIoFinalUrl xsi:type="xsd:string"></XmlIoFinalUrl><XmlIn xsi:type="xsd:string"></XmlIn><XsdIn xsi:type="xsd:string"></XsdIn></ns8471:xmlIoOperation></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response
HTTP/1.1 500 Internal Server Error
Date: Fri, 23 Nov 2007 18:24:33 GMT
Server: Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server
Cache-Control: private
Connection: close
Content-Type: text/xml; charset=iso-8859-1
<?xml version="1.0" encoding="ISO-8859-1"?><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><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>org.xml.sax.SAXException: Invalid element in fr.mycompany.mysystem.outilssvc.xmlio_soap.XmlIoRequest - XmlIoHeader</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">myserver.mycompany.fr</ns1:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
|
I don't understand where the proble is with the client
Anyone can help me? I'm a beginer with WS...
Thanks!
|
|
|
| | |
Joined: 23 Nov 2007 |
Posts: 3 |
|
|
|
Posted: Sun Nov 25, 2007 9:37 am |
|
|
|
|
|
Problem not solved
According to this Topic problems-sending-array-from-nusoap-client-t1570.html?highlight=impl I've tried to add a "type" by using soapval on each element of the array.
But I can't add a good "type" for "XmlIoHeader" (type="impl:XmlIoHeaderType")...
How can I specify this particular type for XmlIoHeader with "soapval" ?? It's just an array, isn't it ?
Please Help!
|
|
|
| | |
Joined: 23 Nov 2007 |
Posts: 3 |
|
|
|
Posted: Tue Nov 27, 2007 10:44 am |
|
|
|
|
|
I've found !!
It was a problem of type namespace. I must define my namespace for each element of my $params !
It's logical for the "complexType" of my WSDL but a little strange for "string" values.
I assume my WSDL have a problem with targetNamespace definitions...
Here is the good client :
$client = new soapclient('http://myserver.mycompany.fr:7777/mysystemws/services/XmlIoPortType', false);
$namespace = 'http://mycompany.fr/mysystem/xmlio/';
$xmlioheader = array( 'SecurityId' => new soapval('SecurityId', 'string', 'login', $namespace),
'SecurityToken' => new soapval('SecurityToken', 'string', '00', $namespace),
'ProcessId' => new soapval('ProcessId', 'string', '', $namespace),
'ParentId' => new soapval('ParentId', 'string', '', $namespace));
$param = array( 'XmlIoHeader' => new soapval('XmlIoHeader', 'XmlIoHeaderType', $xmlioheader, $namespace),
'ClassName' => new soapval('ClassName', 'string', 'fr.mycompany.mysystem.outilsws.securite.SecWs', $namespace),
'OperationName' => new soapval('OperationName', 'string', 'allocateSgc', $namespace),
'XmlIoCurrentUrl' => new soapval('XmlIoCurrentUrl', 'string', '', $namespace),
'XmlIoFinalUrl' => new soapval('XmlIoFinalUrl', 'string', '', $namespace),
'XmlIn' => new soapval('XmlIn', 'string', '', $namespace),
'XsdIn' => new soapval('XsdIn', 'string', '', $namespace)
);
$result = $client->call('xmlIoOperation', $param, $namespace);
|
Hope this help anyone else!
|
|
|
| | |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT - 5 Hours
Page 1 of 1
|
|
|
| |