[Bangalore-pm] soap lite - Trouble in creating multiref xml body
Naresh Ramaswamy
inform.naresh at gmail.com
Tue Dec 22 06:55:01 PST 2009
hi,
I am using SOAP::lite and the module from the stubmaker.pl to invoke SOAP
APIs from WSDL.
my original SOAP request looks like the following
==============================
<?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>
<USER soapenv:mustUnderstand="0" xsi:type="xsd:string">admin</USER>
<PASSWORD soapenv:mustUnderstand="0"
xsi:type="xsd:string">admin</PASSWORD>
<SYSTEMUSER soapenv:mustUnderstand="0" xsi:type="xsd:string"/>
</soapenv:Header>
<soapenv:Body>
<ns1:getNewGroup
xmlns:ns1="http://www.xyznet.com/sms/smsapi/r08_00/NewGroupService"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 href="#id0"/>
<in1 href="#id1"/>
</ns1:getNewGroup>
<multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://www.xyznet.com/sms/smsapi/r08_00/model" id="id1"
soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:NewGroupKey">
<internalId xsi:type="xsd:string">16789900</internalId>
</multiRef>
<multiRef xmlns:ns3="http://www.xyznet.com/sms/smsapi/r08_00/model"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" id="id0"
soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:PartKey">
<internalId xsi:type="xsd:string">15</internalId>
<name xsi:type="xsd:string" xsi:nil="true"/>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
My Perl module from stubmaker.pl that contains the above section looks like
the following
=================================================================
my %methods = (
getNewGroup => {
endpoint => '
http://10.3.1.5/smsapi/services/SMSAPI/r08_00/NewGroupService',
soapaction => '',
namespace => 'http://www.xyznet.com/sms/smsapi/r08_00/NewGroupService',
parameters => [
SOAP::Data->new(name => 'in0', type => 'tns1:PartKey', attr => {}),
SOAP::Data->new(name => 'in1', type => 'tns1:NewGroupKey', attr =>
{}),
], # end parameters
}, # end getNewGroup
My Perl script looks like as follows
=========================
#!/ats/usr/perl -w
use SOAP::Lite +trace => 'debug';
use Data::Dumper;
use SMSAPIService_r08_00_NewGroupService qw(:all);
my $obj = new SMSAPIService_r08_00_NewGroupService;
$obj -> use_prefix(0);
$obj->readable(1);
$obj->want_som(1);
$obj->multirefinplace(1);
my $response = $obj->getNewGroup(En);
My POST request<->response looks as follows
=========================
use_prefix has been deprecated. if you wish to turn off or on the use of a
default namespace, then please use either ns(uri) or default_ns(uri) at
/ats/langs/perl_5.8.7/lib/site_perl/5.8.7/SOAP/Lite.pm line 887.
URI is not provided as an attribute for method (authenticate)
SOAP::Transport::HTTP::Client::send_receive: POST
http://10.3.1.5/smsapi/services/SMSAPI/r08_00/GroupGroupService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 985
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns1="http://www.xyznet.com/sms/smsapi/r08_00/model"
xmlns:impl="http://www.xyznet.com/sms/smsapi/r08_00/GroupGroupService"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
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:Header>
<USER xsi:type="xsd:string">admin</USER>
<PASSWORD xsi:type="xsd:string">admin</PASSWORD>
</soap:Header>
<soap:Body>
<impl:getNewGroup>
<in0 xsi:nil="true" xsi:type="tns1:PartKey" InternalId="15" />
</impl:getNewGroup>
</soap:Body>
</soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server
Error
Connection: close
Date: Tue, 22 Dec 2009 14:49:49 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Client-Date: Tue, 22 Dec 2009 14:49:57 GMT
Client-Peer: 10.3.1.5:80
Client-Response-Num: 1
<?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:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.generalException</faultcode>
<faultstring></faultstring>
<detail>
<ns1:fault href="#id0" xmlns:ns1="
http://www.xyznet.com/sms/smsapi/r08_00/GroupGroupService"/<http://www.xyznet.com/sms/smsapi/r08_00/GroupGroupService%22/>
>
<ns2:exceptionName xmlns:ns2="
http://xml.apache.org/axis/">com.xyz.sms.api.r08_00.model.SMSAPIInternalException</ns2:exceptionName<http://xml.apache.org/axis/%22%3Ecom.xyz.sms.api.r08_00.model.SMSAPIInternalException%3C/ns2:exceptionName>
>
</detail>
</soapenv:Fault>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:SMSAPIInternalException" xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns3="
http://www.xyznet.com/sms/smsapi/r08_00/model">
<errorMessage xsi:type="xsd:string">Group Group Key cannot be null
(com.xyz.sms.common.SMSException: no user message defined)</errorMessage>
<errorCode xsi:type="xsd:int">-9999</errorCode>
<messageKey xsi:type="xsd:string" xsi:nil="true"/>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
========================================
I am unable to construct the SOAP xml body as in my original request wherin
multiRef body content is observed and further I get 500 server error.
Can you please help me to recreate my request using the module generated by
stubmaker?
regards,
Naresh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/bangalore-pm/attachments/20091222/21bf852f/attachment.html>
More information about the Bangalore-pm
mailing list