on 02-13-2009 8:49 AM
Hi, Experts
SAP is new for me and now I need to develop a perl client using soap lite, I have read "HOWTO: SCRIPTING LANGUAGE SUPPORT FOR SAP SERVICES - PERL" but not quit understand that. Can some one show me a real perl client example?
I enclosed the wsdl file generated from SAP web service.
-
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions targetNamespace="urn:sap-com:document:sap:rfc:functions" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:sap-com:document:sap:rfc:functions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions" elementFormDefault="unqualified" attributeFormDefault="qualified">
- <xsd:element name="Z_RFC_WEBSERVICE">
- <xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
- <xsd:element name="Z_RFC_WEBSERVICEResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="EV_STRING" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
- <wsdl:message name="Z_RFC_WEBSERVICE">
<wsdl:part name="parameters" element="tns:Z_RFC_WEBSERVICE" />
</wsdl:message>
- <wsdl:message name="Z_RFC_WEBSERVICEResponse">
<wsdl:part name="parameters" element="tns:Z_RFC_WEBSERVICEResponse" />
</wsdl:message>
- <wsdl:portType name="Z_RFC_WEBSERVICE">
- <wsdl:operation name="Z_RFC_WEBSERVICE">
<wsdl:input message="tns:Z_RFC_WEBSERVICE" />
<wsdl:output message="tns:Z_RFC_WEBSERVICEResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="Z_RFC_WEBSERVICESoapBinding" type="tns:Z_RFC_WEBSERVICE">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="Z_RFC_WEBSERVICE">
<soap:operation soapAction="" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="Z_RFC_WEBSERVICEService">
- <wsdl:port name="Z_RFC_WEBSERVICESoapBinding" binding="tns:Z_RFC_WEBSERVICESoapBinding">
<soap:address location="http://darkwind:9080/sap/bc/srt/rfc/sap/Z_RFC_WEBSERVICE?sap-client=800" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
-
Thanks for your help!
Thanks God it works now!
There was a wrong uri
I changed to $client->uri('urn:sap-com:document:sap:rfc:functions');
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
now I know how to call from perl tool,
#!/usr/bin/perl -wd
use SOAP::Lite;
use SOAP::Lite +trace;
my $client = SOAP::Lite->new();
$client->uri('urn:Z_RFC_WEBSERVICE');
$client->on_action(sub {return'""'});
$client->proxy('http://darkwind:9080/sap/bc/srt/rfc/sap/Z_RFC_WEBSERVICE?sap-client=800');
my $som = $client->Z_RFC_WEBSERVICE();
my $output = $som->result;
print $output "\n";
but I got "Operation not supported" error when executing
my $som = $client->Z_RFC_WEBSERVICE();
here is trace:
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: Z_RFC_WEBSERVICE testtypesZ_RFC_WEBSERVICE
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x93f14a4)
SOAP::Transport::HTTP::Client::send_receive: POST http://darkwind:9080/sap/bc/srt/rfc/sap/Z_RFC_WEBSERVICE?sap-client=800 HTTP/1.1
Accept: text/xml
Accept: multipart/*
Content-Length: 552
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope 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/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:Z_RFC_WEBSERVICE xmlns:namesp1="urn:Z_RFC_WEBSERVICE"><c-gensym3 xsi:type="xsd:string">testtypesZ_RFC_WEBSERVICE</c-gensym3></namesp1:Z_RFC_WEBSERVICE></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x93eb288)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Server: SAP Web Application Server (1.0;700)
Content-Length: 264
Content-Type: text/xml; charset=utf-8
Client-Date: Sat, 14 Feb 2009 19:33:50 GMT
Client-Peer: 146.225.80.176:9080
Client-Response-Num: 1
Sap-Srt-Id: 20090214/113349/v1.00_final_6.40/49958133C5E634E8E100000092E150B0
Set-Cookie: sap-usercontext=sap-client=800; path=/
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Body><soap-env:Fault><faultcode>soap-env:Client</faultcode><faultstring xml:lang="en">Operation not supported</faultstring></soap-env:Fault></soap-env:Body></soap-env:Envelope>
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()
Can't use an undefined value as a symbol reference at ./sapClient.pl line 10.
SOAP::Lite::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Parser::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Transport::HTTP::Client::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::SOM::DESTROY: ()
Ran SAP Web Service Navigator Test 'Z_RFC_WEBSERVICE' OK
Can someone help?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
now I know how to call from perl tool,
#!/usr/bin/perl -wd
use SOAP::Lite;
use SOAP::Lite +trace;
my $client = SOAP::Lite->new();
$client->uri('urn:Z_RFC_WEBSERVICE');
$client->on_action(sub {return'""'});
$client->proxy('http://darkwind:9080/sap/bc/srt/rfc/sap/Z_RFC_WEBSERVICE?sap-client=800');
my $som = $client->Z_RFC_WEBSERVICE();
my $output = $som->result;
print $output "\n";
but I got "Operation not supported" error when executing
my $som = $client->Z_RFC_WEBSERVICE();
here is trace:
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: Z_RFC_WEBSERVICE testtypesZ_RFC_WEBSERVICE
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x93f14a4)
SOAP::Transport::HTTP::Client::send_receive: POST http://darkwind:9080/sap/bc/srt/rfc/sap/Z_RFC_WEBSERVICE?sap-client=800 HTTP/1.1
Accept: text/xml
Accept: multipart/*
Content-Length: 552
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope 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/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:Z_RFC_WEBSERVICE xmlns:namesp1="urn:Z_RFC_WEBSERVICE"><c-gensym3 xsi:type="xsd:string">testtypesZ_RFC_WEBSERVICE</c-gensym3></namesp1:Z_RFC_WEBSERVICE></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x93eb288)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Server: SAP Web Application Server (1.0;700)
Content-Length: 264
Content-Type: text/xml; charset=utf-8
Client-Date: Sat, 14 Feb 2009 19:33:50 GMT
Client-Peer: 146.225.80.176:9080
Client-Response-Num: 1
Sap-Srt-Id: 20090214/113349/v1.00_final_6.40/49958133C5E634E8E100000092E150B0
Set-Cookie: sap-usercontext=sap-client=800; path=/
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Body><soap-env:Fault><faultcode>soap-env:Client</faultcode><faultstring xml:lang="en">Operation not supported</faultstring></soap-env:Fault></soap-env:Body></soap-env:Envelope>
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()
Can't use an undefined value as a symbol reference at ./sapClient.pl line 10.
SOAP::Lite::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Parser::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Transport::HTTP::Client::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::SOM::DESTROY: ()
Ran SAP Web Service Navigator Test 'Z_RFC_WEBSERVICE' OK
Can someone help?
Thanks!
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.