I want to make a SOAP call to a local web service. The web service is defined via a WSDL file (see below). I want to use Perl and SOAP::Lite. I tried this:
use strict ;
use warnings ;
use SOAP::Lite ;
my $endpoint = qq{http://example.com:2222/orawsv/PS_API/ACCOUNT_WS} ;
my $tns = 'http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS' ;
my $method_urn = $tns ;
my $soapaction = $tns ;
my $method = 'GET_BY_ACCOUNT_NUMBER' ;
my $sObj = SOAP::Lite->new(uri => $soapaction, proxy => $endpoint) ;
my $response = $sObj->call(SOAP::Data->name($method)->attr({ 'xmlns' => $method_urn})
=> SOAP::Data->name('ACCOUNT_NUMBER-VARCHAR2-IN' => '274724')) ;
print $response->faultstring() . "\n";
However, this results in an XML parsing failed error message. What would be the correct SOAP::Lite code to make this method call?
The HTTP request generated by the above is
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 553
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS#GET_BY_ACCOUNT_NUMBER"
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GET_BY_ACCOUNT_NUMBER xmlns="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS">
<ACCOUNT_NUMBER-VARCHAR2-IN xsi:type="xsd:int">274724</ACCOUNT_NUMBER-VARCHAR2-IN>
</GET_BY_ACCOUNT_NUMBER>
</soap:Body>
</soap:Envelope>
Here is the WSDL file defining the web service:
<definitions name="ACCOUNT_WS"
targetNamespace="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema targetNamespace="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS" elementFormDefault="qualified">
<xsd:element name="CACCOUNT_A-GET_BY_ACCOUNT_NUMBERInput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ACCOUNT_NUMBER-VARCHAR2-IN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GET_BY_ACCOUNT_NUMBEROutput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RETURN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="GET_BY_ACCOUNT_NUMBERInputMessage">
<part name="parameters" element="tns:CACCOUNT_A-GET_BY_ACCOUNT_NUMBERInput"/>
</message>
<message name="GET_BY_ACCOUNT_NUMBEROutputMessage">
<part name="parameters" element="tns:GET_BY_ACCOUNT_NUMBEROutput"/>
</message>
<portType name="ACCOUNT_WSPortType">
<operation name="GET_BY_ACCOUNT_NUMBER">
<input message="tns:GET_BY_ACCOUNT_NUMBERInputMessage"/>
<output message="tns:GET_BY_ACCOUNT_NUMBEROutputMessage"/>
</operation>
</portType>
<binding name="ACCOUNT_WSBinding" type="tns:ACCOUNT_WSPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GET_BY_ACCOUNT_NUMBER">
<soap:operation soapAction="GET_BY_ACCOUNT_NUMBER"/>
<input>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body parts="parameters" use="literal"/>
</output>
</operation>
</binding>
<service name="ACCOUNT_WSService">
<documentation>Oracle Web Service</documentation>
<port name="ACCOUNT_WSPort" binding="tns:ACCOUNT_WSBinding">
<soap:address location="http://example.com:2222/orawsv/PS_API/ACCOUNT_WS"/>
</port>
</service>
</definitions>
Since you have the WSDL, you shouldn't have to construct SOAP::Data objects at all. Simply load the WSDL into your client object and call the method directly:
my $client = SOAP::WSDL->new(wsdl => $url_of_wsdl);
my $result = $client->$method(#arguments);
Yes, it's that easy!
Looks like this is about a year old, so this might not be relevant any longer. Anyway, based on the soap::lite documentation on CPAN it looks like you want to do this:
my $response = $sObj->call(SOAP::Data->name($method)->attr({ 'xmlns' => $method_urn}),
SOAP::Data->name('parameters')->value(SOAP::Data->value([
SOAP::Data->name('ACCOUNT_NUMBER-VARCHAR2-IN' => '274724'),
]))
);
die $response->fault->{ faultstring } if ($response->fault);
print $response->result, "\n";
Related
I have created WSDL file connect the file with PERL soap method. After the exection i get the below error message
"not well-formed (invalid token) at line 1, column 1, byte 1 at /usr/lib/x86_64-linux-gnu/perl5/5.26/XML/Parser.pm line 187." .
Please let me know have to fix the issue. Review below source code.
soap-client.pl
#!/usr/bin/perl -w
#use SOAP::Lite +trace => ‘debug’;
use SOAP::Lite;
my $client = SOAP::Lite
->service('http://localhost/soap/perl/marketplace.wsdl');
my $result = $client->login( 'test_user', 'test_password' );
#~ my $result = $client->sayHello('');
print $result;
soap-server.pl
#!/usr/bin/perl
function login( $login, $password )
{
return $login;
}
function doFilter( $params )
{
return "some string";
}
marketplace.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="Marketplace"
targetNamespace="urn:Marketplace"
xmlns:tns="urn:Marketplace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="LoginRequest">
<part name="login" type="xsd:string"/>
<part name="password" type="xsd:string"/>
</message>
<message name="LoginResponse">
<part name="result" type="xsd:string"/>
</message>
<portType name="LoginPort">
<operation name="login">
<input message="tns:LoginRequest"/>
<output message="tns:LoginResponse"/>
</operation>
</portType>
<binding name="LoginBinding" type="tns:LoginPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="login">
<soap:operation soapAction="urn:LoginAction"/>
<input>
<soap:body use="encoded" namespace="urn:Marketplace" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:Marketplace" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="WSDLService">
<port name="LoginPort" binding="tns:LoginBinding">
<soap:address location="http://localhost/soap/perl/soap-server.pl"/>
</port>
</service>
</definitions>
finally run the soap-client.pl file return below error message.
"not well-formed (invalid token) at line 1, column 1, byte 1 at /usr/lib/x86_64-linux-gnu/perl5/5.26/XML/Parser.pm line 187." .
Uncomment #use SOAP::Lite +trace => ‘debug’; line and see the resulting error.
I have a SOAP::Lite client using the service method to grab a wsdl. This needs to call a webservice with a single operation and method with no parameters. It's resulting in a nested method call that the provider tells me is wrong. And I'm not very knowledgeable about SOAP::Lite or webservices. Advice appreciated!
my $lookup = SOAP::Lite->service('http://hostname.com/path/SpringVerifierWebServicePort?wsdl')
-> proxy("$theURL") ;
$response = $lookup->verifySpring('');
And that is generating this stub on the call.
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body>
<tns:verifySpring>
<verifySpring xsi:nil="true" xsi:type="tns:verifySpring" />
</tns:verifySpring> </soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x167bee8)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
The provider of that webservice tells me the 500 error is due to the nested verifySpring on the call. Do I need to call this differently than I am, or is the WSDL invalid and screwing up SOAP::Lite? I don't know enough about SOAP and webservices to say if the problem is the WSDL, or if I need to call this differently in SOAP::LITE. Could anyone give me some direction please?
The provider WSDL is this:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="SpringVerifierWebServiceService" targetNamespace="http://webservice.springverifier.toolslang.fedins.com">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" targetNamespace="http://webservice.springverifier.toolslang.fedins.com" version="1.0">
<xs:element name="verifySpring" type="tns:verifySpring" />
<xs:element name="verifySpringResponse" type="tns:verifySpringResponse" />
<xs:complexType name="verifySpring">
<xs:sequence />
</xs:complexType>
<xs:complexType name="verifySpringResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="tns:environmentInfo" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="environmentInfo">
<xs:sequence>
<xs:element minOccurs="0" name="dbRegion" type="xs:string" />
<xs:element minOccurs="0" name="jndi" type="xs:string" />
<xs:element minOccurs="0" name="springProfile" type="xs:string" />
<xs:element minOccurs="0" name="systemDate" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="verifySpringResponse">
<wsdl:part element="tns:verifySpringResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="verifySpring">
<wsdl:part element="tns:verifySpring" name="parameters" />
</wsdl:message>
<wsdl:portType name="SpringVerifierWebService">
<wsdl:operation name="verifySpring">
<wsdl:input message="tns:verifySpring" name="verifySpring" />
<wsdl:output message="tns:verifySpringResponse" name="verifySpringResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SpringVerifierWebServiceServiceSoapBinding" type="tns:SpringVerifierWebService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="verifySpring">
<soap:operation soapAction="" style="document" />
<wsdl:input name="verifySpring">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="verifySpringResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SpringVerifierWebServiceService">
<wsdl:port binding="tns:SpringVerifierWebServiceServiceSoapBinding" name="SpringVerifierWebServicePort">
<soap:address location="http://dev1.spring.service.fedins.com/fedservice/toolslang/springverifier/webservice/services/SpringVerifierWebServicePort" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
'' is an actual value (empty string), use verifySpring(); and not verifySpring('');
Example
#!/usr/bin/perl --
use strict;
use warnings;
use SOAP::Lite;
my $soap = SOAP::Lite
-> uri('http://127.0.0.1/MyModule')
-> proxy('http://127.0.0.1:1203')
;;;;;;;;;
$soap->readable(1);
$soap->transport->add_handler("request_send", sub { print $_[0]->as_string,"\n"; return } );
eval { $soap->verifySpring(''); 1 } or print "$#\n";
eval { $soap->verifySpring(); 1 } or print "$#\n";
__END__
POST http://127.0.0.1:1203 HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/1.11
Content-Length: 522
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://127.0.0.1/MyModule#verifySpring"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<verifySpring xmlns="http://127.0.0.1/MyModule">
<c-gensym3 xsi:type="xsd:string" />
</verifySpring>
</soap:Body>
</soap:Envelope>
500 Can't connect to 127.0.0.1:1203 at - line 11.
POST http://127.0.0.1:1203 HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/1.11
Content-Length: 475
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://127.0.0.1/MyModule#verifySpring"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<verifySpring xmlns="http://127.0.0.1/MyModule" xsi:nil="true" />
</soap:Body>
</soap:Envelope>
500 Can't connect to 127.0.0.1:1203 at - line 12.
I tried to pull JAX-WS SOAP 1.2 WSDL service using iOS. I used WSDL2ObjC converter to convert the url (WSDL file given below) into class files.
NSDate+ISO8601Parsing.h
NSDate+ISO8601Parsing.m
NSDate+ISO8601Unparsing.h
NSDate+ISO8601Unparsing.m
SimpleWebServiceServiceSvc.h
SimpleWebServiceServiceSvc.m
USAdditions.h
USAdditions.m
USGlobals.h
USGlobals.m
xs.h
xs.m
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://sample.jaxws.ws.blog.accrd.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://sample.jaxws.ws.blog.accrd.com/" name="SimpleWebServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://sample.jaxws.ws.blog.accrd.com/" schemaLocation="http://192.168.1.45:8080/SimpleWebService/SimpleWebService?xsd=1"/>
</xsd:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="SimpleWebService">
<operation name="sayHello">
<input wsam:Action="http://sample.jaxws.ws.blog.accrd.com/SimpleWebService/sayHelloRequest" message="tns:sayHello"/>
<output wsam:Action="http://sample.jaxws.ws.blog.accrd.com/SimpleWebService/sayHelloResponse" message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="SimpleWebServicePortBinding" type="tns:SimpleWebService">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello">
<soap12:operation soapAction=""/>
<input>
<soap12:body use="literal"/>
</input>
<output>
<soap12:body use="literal"/>
</output>
</operation>
</binding>
<service name="SimpleWebServiceService">
<port name="SimpleWebServicePort" binding="tns:SimpleWebServicePortBinding">
<soap12:address location="http://192.168.1.45:8080/SimpleWebService/SimpleWebService"/>
</port>
</service>
</definitions>
I got above files and implemented into my project and tried to pull the service using below codings.
SimpleWebServicePortBinding *binding = [SimpleWebServiceServiceSvc SimpleWebServicePortBinding];
binding.logXMLInOut = YES;
SimpleWebServicePortBindingResponse *response;
SimpleWebServiceServiceSvc_sayHello *sayHello = [[SimpleWebServiceServiceSvc_sayHello alloc] init];
sayHello.arg0 = [[SimpleWebServiceServiceSvc_customer alloc] init];
sayHello.arg0.firstName = #"FirstName";
sayHello.arg0.lastName = #"LastName";
response = [binding sayHelloUsingParameters:sayHello];
dispatch_async(dispatch_get_main_queue(), ^{
[self processResponse:response];
});
But I'm always getting below response. Can any one help me how to solve this or any other way to use JAX-WS service in iOS.
2013-07-25 12:37:59.205 LocalWSDL[1356:11303] OutputHeaders:
{
"Content-Length" = 729;
"Content-Type" = "application/soap+xml; charset=utf-8";
Host = "192.168.1.45";
SOAPAction = "";
"User-Agent" = wsdl2objc;
}
2013-07-25 12:37:59.225 LocalWSDL[1356:11303] OutputBody:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SimpleWebServiceServiceSvc="http://sample.jaxws.ws.blog.accrd.com/" xsl:version="1.0">
<soap:Body>
<SimpleWebServiceServiceSvc:sayHello>
<SimpleWebServiceServiceSvc:arg0>
<SimpleWebServiceServiceSvc:firstName>FirstName</SimpleWebServiceServiceSvc:firstName>
<SimpleWebServiceServiceSvc:lastName>LastName</SimpleWebServiceServiceSvc:lastName>
</SimpleWebServiceServiceSvc:arg0>
</SimpleWebServiceServiceSvc:sayHello>
</soap:Body>
</soap:Envelope>
2013-07-25 12:37:59.239 LocalWSDL[1356:11303] ResponseStatus: 500
2013-07-25 12:37:59.239 LocalWSDL[1356:11303] ResponseHeaders:
{
"Content-Type" = "application/soap+xml; charset=utf-8";
Date = "Thu, 25 Jul 2013 07:08:06 GMT";
"Transfer-Encoding" = Identity;
}
2013-07-25 12:37:59.240 LocalWSDL[1356:11303] ResponseBody:
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"><S:Body><S:Fault xmlns:ns4="http://schemas.xmlsoap.org/soap/envelope/"><S:Code><S:Value>S:Receiver</S:Value></S:Code><S:Reason><S:Text xml:lang="en">java.lang.NullPointerException</S:Text></S:Reason></S:Fault></S:Body></S:Envelope>
I used http://wsclient.neurospeech.com/download/ to covert my WSDL link into classes.
NSWSDL.h
NSWSDL.m
SimpleWebService.h
SimpleWebService.m
Then used only four line codings to finish my Task. Thanks for wsclient :).
This may useful for some one.
SimpleWebServiceService *objService = [SimpleWebServiceService service];
WEcustomer *argument = [[WEcustomer alloc] init];
argument.firstName = #"Ganesh";
argument.lastName = #"Ananthan";
NSError *error;
NSString *myresult = [objService sayHello:argument error:&error];
NSLog(#" My Result %#",myresult);
I trying to make a web service accessible to Matlab. I can call it from PHP but Matlab doesn't seem to be able to parse the definition.
??? Attempt to reference field of non-structure array.
Error in ==> createClassFromWsdl>parseWsdl at 72
se = defTypes.getExtensibilityElements().get(0);
Error in ==> createClassFromWsdl at 32
[R, schema] = parseWsdl(wsdlUrl);
WSDL File:
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='server3'
targetNamespace='http://server.edu/php/soap_test/server3.wsdl'
xmlns:tns='http://server.edu/php/soap_test/server3.wsdl'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<xsd:complexType name="ActivityData">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="HomeId" type="string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="TStamp" type="string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="Description" type="string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfActivityData">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="keyval" type="tns:ActivityData"/>
</xsd:sequence>
</xsd:complexType>
<message name='getRangeRequest'>
<part name='inHomeId' type='xsd:int'/>
<part name='inStartDate' type='xsd:string'/>
<part name='inEndDate' type='xsd:string'/>
</message>
<message name='getRangeResponse'>
<part name='out1' type='ArrayOfActivityData'/>
</message>
<portType name='getRangePortType'>
<operation name='getRange'>
<input message='tns:getRangeRequest'/>
<output message='tns:getRangeResponse'/>
</operation>
</portType>
<binding name='getRangeBinding' type='tns:getRangePortType'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getRange'>
<soap:operation soapAction='urn:xmethods-get-range#getRange'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-get-range' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-get-range' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='getRangeService'>
<port name='getRangePort' binding='getRangeBinding'>
<soap:address location='http://server.edu/php/soap_test/soap_server3.php'/>
</port>
</service>
</definitions>
Reading the Matlab docs states:
The createClassFromWsdl function works with WSDL documents that comply with the WS-I 1.0 standard and use one of these forms: RPC-encoded, RPC-literal, Document-literal, or Document-literal-wrapped.
My Matlab install works with some sample WSDL files. So now Im trying to figure out what's wrong with mine. Suggestions?
FWIW: There are four issues:
1) the 'xsd:complexType' entries need to be in a 'types' section.
2) the 'service/port#binding' attribute needs to be 'tns:getRangeBinding'.
3) 'binding/operation/soap:operation#soapAction' should be 'urn:xmethods-get-range:getRange'
4) 'binding/operation/input/soap:body#namespace' should match #3.
I'm trying to figure out how to write the array part of a SOAP request whose relevant part of its WSDL is this:
<xsd:complexType name="ArrayOfProductInfo">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:ProductInfo[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ProductInfo">
<xsd:all>
<xsd:element name="productID" type="xsd:string"/>
<xsd:element name="quantity" type="xsd:int"/>
<xsd:element name="price" type="xsd:float"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="clCostRequest">
<xsd:all>
<xsd:element name="language" type="xsd:string"/>
<xsd:element name="items" type="tns:ArrayOfProductInfo"/>
<xsd:element name="shipmentOriginCountry" type="xsd:string"/>
<xsd:element name="shipmentDestinationCountry" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
With soapUI, I'm able to see that the SOAP request should look as follows, except for what I've wrapped in "????" tags, which soapUI is not displaying. (Note also that it's displaying this node as a self-closing tag.)
<soapenv:Envelope mlns:xsi="http:...">
<soapenv:Header/>
<soapenv:Body>
<clCost soapenv:encodingStyle="http://schemas.xmlsoap.org/...">
<request xsi:type="clCostRequest">
<language xsi:type="xsd:string">en</language>
<items xsi:type="ArrayOfProductInfo" soapenc:arrayType="ProductInfo[]"/>
<????>productID</????>
<????>quantity</????>
<????>price</????>
<????>productID</????>
<????>quantity</????>
<????>price</????>
<shipmentOriginCountry xsi:type="xsd:string">US</shipmentOriginCountry>
<shipmentDestinationCountry xsi:type="xsd:string">DE</shipmentDestinationCountry>
</request>
</clCost>
</soapenv:Body>
</soapenv:Envelope>
I need to pass in that "ProductInfo" array but I don't know what its tags should look like. I've tried this to no avail:
<items xsi:type="ArrayOfProductInfo" soapenc:arrayType="ProductInfo[]">
<ProductInfo xsi:type="tns:ProductInfo">
<productID xsi:type="xsd:string">86595</productID>
<quantity xsi:type="xsd:int">50</quantity>
<price xsi:type="xsd:float">1.99</price>
</ProductInfo>
<ProductInfo xsi:type="tns:ProductInfo">
<productID xsi:type="xsd:string">12215</productID>
<quantity xsi:type="xsd:int">60</quantity>
<price xsi:type="xsd:float">5.99</price>
</ProductInfo>
</items>
Any hints or references to similar examples would be greatly appreciated!
SoapUI will translate the WSDL you give him and display you the requests and their parameters. Whatever SOAPUI generated from WSDL should be correct. Therefore I advise you to check your WSDL, because the fault is there.
This should Work
<soapenv:Envelope mlns:xsi="http:...">
<soapenv:Header/>
<soapenv:Body>
<clCost soapenv:encodingStyle="http://schemas.xmlsoap.org/...">
<request xsi:type="clCostRequest">
<language xsi:type="xsd:string">en</language>
<items xsi:type="ArrayOfProductInfo" soapenc:arrayType="ProductInfo[]">
<item xsi:type="xsd:ProductInfo">
<productID xsi:type="xsd:string">86595</productID>
<quantity xsi:type="xsd:int">50</quantity>
<price xsi:type="xsd:float">1.99</price>
</item>
<item xsi:type="xsd:ProductInfo">
<productID xsi:type="xsd:string">12215</productID>
<quantity xsi:type="xsd:int">60</quantity>
<price xsi:type="xsd:float">5.99</price>
</item>
</items>
<shipmentOriginCountry xsi:type="xsd:string">US</shipmentOriginCountry>
<shipmentDestinationCountry xsi:type="xsd:string">DE</shipmentDestinationCountry>
</request>
</clCost>
</soapenv:Body>
</soapenv:Envelope>