Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] SOAP::Lite 0.69 and FedEx web services.

Expand Messages
  • Eric Bridger
    Yes. Support for WSDLs in SOAP Lite is minimal so you will need to use SOAP::Data to format your messages and for parsing the responses. This site has quite a
    Message 1 of 2 , Jan 27, 2008
    • 0 Attachment
      Yes. Support for WSDLs in SOAP Lite is minimal so you will need to
      use SOAP::Data to format your messages and for parsing the responses.

      This site has quite a few good examples:
      http://www.soaplite.com/archives.html

      In particular see the page on building complex types.
      http://www.soaplite.com/complex_types/index.html

      Eric

      On Jan 26, 2008, at 10:32 AM, phoose2 wrote:

      > I'm pretty new to soap and trying to develop an application to rate
      > and eventually ship and print labels for shipments. Here's a current
      > look at some of the code:
      >
      > my $wsdl = 'file:./RateService_v2.wsdl';
      > my $soap = SOAP::Lite->service($wsdl);
      >
      > my $response = $soap->getRate();
      >
      > if ($response) {
      > if ($response->fault) {
      > printf "A fault (%s) occured: %s\n", $response->faultcode,
      > $response->faultstring;
      > }
      > }
      >
      > When I do this I always get an "1: Invalid transaction type" error
      > from FedEx, I've tried this with sending data as well, but got the
      > same error, so I removed the data to concentrate on the connection
      > issues and to keep the above example short. In the above case
      > $response is undef.
      >
      > I noticed that if I use:
      >
      > my $soap =
      > SOAP::Lite->proxy('https://gatewaybeta.fedex.com:443/web-services')
      > ->uri('http://fedex.com/ws/rate/v2');
      >
      > instead of the wsdl file some changes happen:
      >
      > 1: The SOAPAction in the trace changes:
      >
      > From:
      >
      > SOAPAction: "getRate"
      >
      > To:
      >
      > SOAPAction: "http://fedex.com/ws/rate/v2#getRate"
      >
      > 2: <soap:Envelope xmlns:ns="http://fedex.com/ws/rate/v2"...
      >
      > is removed from the XML data.
      >
      > 3: $response is no longer undef, but instead includes the xml sent
      > from the server.
      >
      > It looks like if I use the non-wsdl version I may need to use
      > SOAP::Data to properly format my data, is this correct? If so any good
      > examples of this would be great. I have the book "Programming Web
      > Services With Perl" as well so if it's something I missed in there let
      > me know :)
      >
      > With Trace debug turned on here's the full output using the wsdl:
      >
      > Content-Type: text/html; charset=ISO-8859-1
      >
      > SOAP::Transport::HTTP::Client::send_receive: POST
      > https://gatewaybeta.fedex.com:443/web-services HTTP/1.1
      > Accept: text/xml
      > Accept: multipart/*
      > Accept: application/soap
      > Content-Length: 484
      > Content-Type: text/xml; charset=utf-8
      > SOAPAction: "getRate"
      >
      > <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
      > xmlns:ns="http://fedex.com/ws/rate/v2"
      > 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
      > xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/"
      > xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ns:getRate
      > xsi:nil="true" /></soap:Body></soap:Envelope>
      > SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Server Error
      > Connection: close
      > Date: Sat, 26 Jan 2008 15:23:16 GMT
      > Server: Sun-ONE-Web-Server/6.1
      > Content-Length: 543
      > Content-Type: text/xml; charset=utf-8
      > Client-Date: Sat, 26 Jan 2008 15:23:16 GMT
      > Client-Peer: 199.81.198.77:443
      > Client-Response-Num: 1
      > Client-SSL-Cert-Issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust
      > Network/OU=Terms of use at https://www.verisign.com/rpa
      > (c)06/CN=VeriSign Class 3 Extended Validation SSL CA
      > Client-SSL-Cert-Subject:
      > /1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/
      > 2.5.4.15=V1.0,
      > Clause
      > 5.(b)/serialNumber=2803030/C=US/2.5.4.17=38017/ST=Tennessee/
      > L=Collierville/2.5.4.9=80
      > Fedex Parkway 1st FL H/O=FedEx
      > Corporation/OU=BST/CM/CN=gatewaybeta.fedex.com
      > Client-SSL-Cipher: RC4-MD5
      > Client-SSL-Warning: Peer certificate not verified
      > X-Powered-By: Servlet/2.4 JSP/2.0
      >
      > <?xml version="1.0" encoding="utf-8"?>
      > <soapenv:Envelope
      > xmlns:soapenv="http://schemas.xmlsoap.org/soap/
      > envelope/"><soapenv:Header/><soap:Body
      > xmlns:soap="http://schemas.xmlsoap.org/soap/
      > envelope/"><soap:Fault><faultcode>soap:Server</
      > faultcode><faultstring>1:
      > Invalid transaction type</faultstring><detail><con:fault
      > xmlns:con="http://www.bea.com/wli/sb/context"><con:errorCode>1</
      > con:errorCode><con:reason>Invalid
      > transaction type. Transaction could not be
      > routed.</con:reason></con:fault></detail></soap:Fault></soap:Body></
      > soapenv:Envelope>
      >
      > STATUS:
      >
      > NO response!
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.