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

Re: [soaplite] Multiple attr and "anyType" (Client: Soap::Lite/Server: MS SOAP)

Expand Messages
  • Sadanand Kalasabail
    If you are using a proxyserver you have to send the proxy logins, the easy way is by setting the env in the soaplite client script for eg.
    Message 1 of 4 , Sep 16 7:02 PM
    • 0 Attachment
      If you are using a proxyserver you have to send the
      proxy logins, the easy way is by setting the env in
      the soaplite client script for eg.
      $ENV{HTTP_proxy}="http://sk7260:Sadanand43@10.2.19.71:8080";

      I have successfully used it behind the firewall.
      There are other options too, see the soaplite toolkit.

      Regards

      sade



      --- mpafrica2001 <yahoo@...> wrote:
      > Apologies for the length of this message but I've
      > tried to include
      > everything relevent. Unfortunately, I can't make the
      > web service
      > available outside our firewall.
      >
      > I'm trying to communicate with a WSDL based service
      > on
      > an MS SOAP server. If anybody has done that and can
      > share code or ideas, I'd love to see it.
      >
      > I've found a lot of documentation on how to talk to
      > .NET SOAP
      > (which I have working) but very little about the MS
      > SOAP
      > toolkit (which I haven't).
      >
      > I've been given an XML trace of a successful session
      > with a VB
      > client which I include below. I've also included the
      > WSDL.
      >
      > Client: SOAP::Lite 0.60
      > Server: MS SOAP toolkit (version 3 I believe)
      >
      > FaultCode: SOAP-ENV:Server
      > FaultString: SoapMapper: Restoring data into
      > SoapMapper
      > anyType failed
      >
      > Notes:
      >
      > - The error seems fair enough as I am passing
      > strings instead
      > of "anyType"s
      >
      > - The WSDL lists the last two parameters as type
      > anyType.
      > Explicitly setting them as such in the SOAP::Data
      > calls
      > returns the SOAP::Lite error: Schema/namespace for
      > type
      > 'anyType' is not specified
      >
      > - The VB code creates data entries with two xmlns
      > attributes
      > (in two different namespaces). I haven't been able
      > to
      > generate this with SOAP::Lite. Maybe I need to
      > write
      > a custom serializer.
      >
      > - Any help/suggestions very gratefully received.
      >
      > Perl Client code (IP addresses ellided):
      >
      > use SOAP::Lite +trace => 'debug';
      >
      > my $service = SOAP::Lite
      > ->service('http://IP
      > ADDRESS/webservices/ntlBusiness.wsdl')
      > ->readable(1);
      >
      > my $method = SOAP::Data->name('CheckAvailability')
      > ->attr({xmlns =>
      > 'http://tempuri.org/ntlBusiness/message/'});
      >
      > my $av = SOAP::Data->name('strAvailability')
      > ->attr({xmlns =>
      > 'http://www.w3.org/2001/XMLSchema-instance'})
      > ->type('string')->value('');
      >
      > my $ed = SOAP::Data->name('strEnabledDate')
      > ->attr({xmlns =>
      > 'http://www.w3.org/2001/XMLSchema-instance'})
      > ->type('string')->value('');
      >
      > my $result = $service->CheckAvailability('PO57 0DE',
      > '01256881234',
      > $av, $ed)
      > ->result;
      >
      > print STDERR $result;
      >
      >
      > Perl client XML trace
      >
      > ?xml version="1.0" encoding="UTF-8"?>
      > <SOAP-ENV:Envelope
      >
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      >
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      >
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      > <SOAP-ENV:Body>
      > <namesp1:CheckAvailability
      >
      xmlns:namesp1="http://tempuri.org/ntlBusiness/message/">
      > <strPostCode xsi:type="xsd:string"
      > >PO57 0DE</strPostCode>
      > <strPhoneNumber xsi:type="xsd:string"
      > >01256881234</strPhoneNumber>
      > <strAvailability
      > xmlns="http://www.w3.org/2001/XMLSchema-instance"
      > xsi:type="xsd:string"/>
      > <strEnabledDate
      > xmlns="http://www.w3.org/2001/XMLSchema-instance"
      > xsi:type="xsd:string"/>
      > </namesp1:CheckAvailability><
      > /SOAP-ENV:Body>
      > </SOAP-ENV:Envelope>
      >
      > VB client xml trace:
      > ----- sent --------
      > <?xml version="1.0" encoding="UTF-8" standalone="no"
      > ?>
      > <SOAP-ENV:Envelope
      >
      >
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >
      >
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      > <SOAP-ENV:Body>
      > <SOAPSDK1:CheckAvailability
      >
      >
      xmlns:SOAPSDK1="http://tempuri.org/ntlBusiness/message/">
      > <strPostCode>SL7 1HX</strPostCode>
      > <strPhoneNumber>01628474907</strPhoneNumber>
      > <strAvailability
      >
      >
      xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
      >
      > xmlns:SOAPSDK3="http://www.w3.org/2001/XMLSchema"
      > SOAPSDK2:type="SOAPSDK3:string" />
      > <strEnabledDate
      >
      >
      xmlns:SOAPSDK4="http://www.w3.org/2001/XMLSchema-instance"
      >
      > xmlns:SOAPSDK5="http://www.w3.org/2001/XMLSchema"
      > SOAPSDK4:type="SOAPSDK5:string" />
      > </SOAPSDK1:CheckAvailability>
      > </SOAP-ENV:Body>
      > </SOAP-ENV:Envelope>
      >
      > ----- received --------
      >
      > <?xml version="1.0" encoding="UTF-8"
      > standalone="no" ?>
      > <SOAP-ENV:Envelope
      >
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      > <SOAP-ENV:Body>
      > <SOAPSDK1:CheckAvailabilityResponse
      >
      xmlns:SOAPSDK1="http://tempuri.org/ntlBusiness/message/">
      > <Result>0</Result>
      > <strPostCode>SL7 1HX</strPostCode>
      > <strPhoneNumber>01628474907</strPhoneNumber>
      > <strAvailability
      >
      xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
      > xmlns:SOAPSDK3="http://www.w3.org/2001/XMLSchema"
      > SOAPSDK2:type="SOAPSDK3:string">G</strAvailability>
      > <strEnabledDate
      >
      xmlns:SOAPSDK4="http://www.w3.org/2001/XMLSchema-instance"
      > xmlns:SOAPSDK5="http://www.w3.org/2001/XMLSchema"
      > SOAPSDK4:type="SOAPSDK5:string" />
      > </SOAPSDK1:CheckAvailabilityResponse>
      > </SOAP-ENV:Body>
      > </SOAP-ENV:Envelope>
      >
      > WSDL (IP addresses ellided):
      >
      > <?xml version="1.0" encoding="UTF-8" ?>
      > - <!-- Generated 08/13/03 by Microsoft SOAP Toolkit
      > WSDL File
      > Generator, Version 3.00.1325.0
      > -->
      > - <definitions name="ntlBusiness"
      >
      targetNamespace="http://tempuri.org/ntlBusiness/wsdl/"
      > xmlns:wsdlns="http://tempuri.org/ntlBusiness/wsdl/"
      > xmlns:typens="http://tempuri.org/ntlBusiness/type/"
      > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      >
      xmlns:stk="http://schemas.microsoft.com/soap-toolkit/wsdl-extension"
      >
      xmlns:dime="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
      >
      xmlns:ref="http://schemas.xmlsoap.org/ws/2002/04/reference/"
      >
      xmlns:content="http://schemas.xmlsoap.org/ws/2002/04/content-type/"
      > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
      > xmlns="http://schemas.xmlsoap.org/wsdl/">
      > - <types>
      > - <schema
      >
      targetNamespace="http://tempuri.org/ntlBusiness/type/"
      > xmlns="http://www.w3.org/2001/XMLSchema"
      >
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
      > elementFormDefault="qualified">
      > <import
      >
      namespace="http://schemas.xmlsoap.org/soap/encoding/"
      > />
      > <import
      > namespace="http://schemas.xmlsoap.org/wsdl/" />
      > <import namespace="http://schemas.xmlsoap.org/ws
      > /2002/04/reference/" />
      > <import
      >
      === message truncated ===


      __________________________________
      Do you Yahoo!?
      Yahoo! SiteBuilder - Free, easy-to-use web site design software
      http://sitebuilder.yahoo.com
    • mpafrica2001
      ... Thanks Sadanand, but proxying is not my problem. I have no problemsconnecting with the webservice, I just can t get the XML formed in a way that MS Soap
      Message 2 of 4 , Sep 17 2:38 AM
      • 0 Attachment
        --- In soaplite@yahoogroups.com, Sadanand Kalasabail <sade_bhat@y...>
        wrote:
        > If you are using a proxyserver you have to send the
        > proxy logins, the easy way is by setting the env in
        > the soaplite client script for eg.
        > $ENV{HTTP_proxy}="http://sk7260:Sadanand43@1...:8080";
        >

        Thanks Sadanand, but proxying is not my problem. I have no
        problemsconnecting with the webservice, I just can't get the
        XML formed in a way that MS Soap will accept.

        Cheers,

        --
        Michael Brader michael.brader@...
        Senior Software Developer (Unix) ntl:ipd
        Hook 01256 75(3413)
      • mpafrica2001
        ... I ve found solutions to both my problems. To use the anyType type specifier as found in the WSDL, I used typelookup to set up the type in SOAP::Lite.
        Message 3 of 4 , Sep 17 7:40 AM
        • 0 Attachment
          --- In soaplite@yahoogroups.com, "mpafrica2001" <yahoo@b...> wrote:
          > Apologies for the length of this message but I've tried to include
          > everything relevent....

          I've found solutions to both my problems. To use the
          anyType type specifier as found in the WSDL, I used
          typelookup to set up the type in SOAP::Lite.

          $service->typelookup->{'anyType'} =
          [11, sub { 1 }, 'as_anyType'];

          sub SOAP::Serializer::as_anyType {
          my $self = shift;
          my ($value, $name, $type, $attr) = @_;
          return [$name, {'xsi:type' => 'xsd:string', %{$attr}}, $value];
          }

          and to put multiple xmlns attributes on a data element, I used:

          my $av = SOAP::Data->name('strAvailability')
          ->attr({'xmlns:namesp2' => 'http://www.w3.org/2001/XMLSchema',
          'xmlns:namesp3' =>
          'http://www.w3.org/2001/XMLSchema-Instance'})
          ->type('anyType')->value('');

          A bit of hacking on the on_action sub and I'm now happily talking to
          the MS Soap Toolkit server.

          Cheers,

          --
          Michael Brader michael.brader@n...
          Senior Software Developer (Unix) ntl:ipd
          Hook 01256 75(3413)
        Your message has been successfully submitted and would be delivered to recipients shortly.