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

Would REALLY appreciate help - new to SOAPLite

Expand Messages
  • grantcblair
    Hi Folks, I m relatively new to SOAPLite, as I inherited an application which relies on it for web services (from a client perspective). I m trying to generate
    Message 1 of 2 , Mar 29, 2012
    • 0 Attachment
      Hi Folks,

      I'm relatively new to SOAPLite, as I inherited an application which relies on it for web services (from a client perspective). I'm trying to generate a SOAP call like this (tested in SOAPUI):

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:ns="http://delegosoftware.com/ns"
      xmlns:def="http://delegosoftware.com/definitions">
      <soapenv:Header/>
      <soapenv:Body>
      <ns:AuthorizationRequest>
      <def:AuthorizationRequestProcess>
      <def:Authorize encrypt="false" merchant="DEMOMERCHANT">
      <def:CCAUT>
      <def:Ccins>Visa</def:Ccins>
      <def:Ccnum>B598A5ED6C7024D3-1111</def:Ccnum>
      <def:Datbi>20140930</def:Datbi>
      <def:Ccname>JOE CONSUMER</def:Ccname>
      <def:Autwv>154.18</def:Autwv>
      <def:Ccwae>USD</def:Ccwae>
      <def:Merch>DEMOMERCHANT</def:Merch>
      <def:Cvval>111</def:Cvval>
      </def:CCAUT>
      </def:Authorize>
      </def:AuthorizationRequestProcess>
      </ns:AuthorizationRequest>
      </soapenv:Body>
      </soapenv:Envelope>
      +--------------------------------
      Nothing too fancy here. Basic call to AuthorizationRequest with a bunch of parameters.


      My perl (SOAPLite) to do the equivalent is:

      use SOAP::Lite +trace;

      my $soap = SOAP::Lite ->uri('http://carina.delego.ca:8080')
      ->proxy( 'http://carina.delego.ca:8080/DelegoWS/services/DelegoWS' ) ;

      $soap->service('http://carina.delego.ca:8080/DelegoWS/services/DelegoWS?wsdl' ) ;
      $soap->readable(1) ;

      my $serializer = $soap->serializer();
      $serializer->register( 'http://delegosoftware.com/ns', 'ns' );


      $serializer->namespaces({
      "http://schemas.xmlsoap.org/soap/envelope/"=>"soapenv",
      "http://delegosoftware.com/ns"=>"ns",
      "http://delegosoftware.com/definitions"=>"def"});


      my $cardtype = 'Visa' ;
      my $expdate = '20141231' ;
      my $cardnum = 'B598A5ED6C7024D3-1111' ;
      my $nameoncard = 'JOE CONSUMER' ;
      my $authamount = 150.12 ;
      my $currency = 'USD' ;
      my $merchid = 'DEMOMERCHANT' ;
      my $cvv = 111 ;
      my $street = '6415 Hwy 70' ;
      my $zip = 10000 ;


      my $som = $soap->call('ns:AuthorizationRequest',
      SOAP::Data->name('def:AuthorizationRequestProcess'
      => \SOAP::Data->name('def:Authorize' =>
      \SOAP::Data->name('def:CCAUT' =>
      \SOAP::Data->value(
      SOAP::Data->name("def:Ccins" => $cardtype)->type(''),
      SOAP::Data->name("def:Datbi" => $expdate)->type(''),
      SOAP::Data->name("def:Ccnum" => $cardnum)->type(''),
      SOAP::Data->name("def:Ccname" => $nameoncard)->type(''),
      SOAP::Data->name("def:Autwv" => $authamount)->type('')->type(''),
      SOAP::Data->name("def:Ccwae" => $currency)->type(''),
      SOAP::Data->name("def:Merch" => $merchid)->type(''),
      SOAP::Data->name("def:Cvval" => $cvv)->type(''),
      SOAP::Data->name("def:Stras" => $street)->type(''),
      SOAP::Data->name("def:Pstlz" => $zip)->type('')
      )
      ))->attr({encrypt => false,merchant => $merchid})
      )
      ) ;

      +-----------------------------------------------------------
      Again, nothing particularly involved. But the issue comes with the XML this generates:

      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:def="http://delegosoftware.com/definitions"
      xmlns:ns="http://delegosoftware.com/ns"
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
      <ns:AuthorizationRequest xmlns:ns="http://carina.delego.ca:8080">
      <def:AuthorizationRequestProcess>
      <def:Authorize encrypt="false" merchant="DEMOMERCHANT">
      <def:CCAUT>
      <def:Ccins>Visa</def:Ccins>

      <def:Datbi>20141231</def:Datbi>

      <def:Ccnum>B598A5ED6C7024D3-1111</def:Ccnum>

      <def:Ccname>JOE CONSUMER</def:Ccname>

      <def:Autwv>150.12</def:Autwv>

      <def:Ccwae>USD</def:Ccwae>

      <def:Merch>DEMOMERCHANT</def:Merch>

      <def:Cvval>111</def:Cvval>

      <def:Stras>6415 Hwy 70</def:Stras>

      <def:Pstlz>10000</def:Pstlz>
      </def:CCAUT>
      </def:Authorize>
      </def:AuthorizationRequestProcess>
      </ns:AuthorizationRequest>
      </soapenv:Body>
      </soapenv:Envelope>
      +---------------------------------------------------------------

      How can I make SOAPLITE suppress the:

      xmlns:ns="http://carina.delego.ca:8080

      or at least the :ns

      from the

      <ns:AuthorizationRequest line, so it better matches the SOAPUI example which I know works?


      Cheers,

      Grant
    • Martin Busik
      Hi Grant, ... this causes the namespace attribute on your WS-Operation-Element (eg the first argument to proxy- call(...)) use
      Message 2 of 2 , Mar 29, 2012
      • 0 Attachment
        Hi Grant,

        > SOAP::Lite ->uri('http://carina.delego.ca:8080')

        this causes the namespace attribute on your WS-Operation-Element (eg the
        first argument to proxy->call(...))

        use ->uri("http://delegosoftware.com/ns") instead, then you should get the
        expected result.

        Cheers,
        martin

        > -----Ursprüngliche Nachricht-----
        > Von: soaplite@yahoogroups.com [mailto:soaplite@yahoogroups.com] Im Auftrag
        > von grantcblair
        > Gesendet: Donnerstag, 29. März 2012 21:59
        > An: soaplite@yahoogroups.com
        > Betreff: [soaplite] Would REALLY appreciate help - new to SOAPLite
        >
        > Hi Folks,
        >
        > I'm relatively new to SOAPLite, as I inherited an application which relies
        on it for web
        > services (from a client perspective). I'm trying to generate a SOAP call
        like this
        > (tested in SOAPUI):
        >
        > <soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:ns="http://delegosoftware.com/ns"
        > xmlns:def="http://delegosoftware.com/definitions">
        > <soapenv:Header/>
        > <soapenv:Body>
        > <ns:AuthorizationRequest>
        > <def:AuthorizationRequestProcess>
        > <def:Authorize encrypt="false" merchant="DEMOMERCHANT">
        > <def:CCAUT>
        > <def:Ccins>Visa</def:Ccins>
        > <def:Ccnum>B598A5ED6C7024D3-1111</def:Ccnum>
        > <def:Datbi>20140930</def:Datbi>
        > <def:Ccname>JOE CONSUMER</def:Ccname>
        > <def:Autwv>154.18</def:Autwv>
        > <def:Ccwae>USD</def:Ccwae>
        > <def:Merch>DEMOMERCHANT</def:Merch>
        > <def:Cvval>111</def:Cvval>
        > </def:CCAUT>
        > </def:Authorize>
        > </def:AuthorizationRequestProcess>
        > </ns:AuthorizationRequest>
        > </soapenv:Body>
        > </soapenv:Envelope>
        > +--------------------------------
        > Nothing too fancy here. Basic call to AuthorizationRequest with a bunch of
        > parameters.
        >
        >
        > My perl (SOAPLite) to do the equivalent is:
        >
        > use SOAP::Lite +trace;
        >
        > my $soap = SOAP::Lite ->uri('http://carina.delego.ca:8080')
        > ->proxy( 'http://carina.delego.ca:8080/DelegoWS/services/DelegoWS' )
        ;
        >
        >
        $soap->service('http://carina.delego.ca:8080/DelegoWS/services/DelegoWS?wsdl
        ' )
        > ;
        > $soap->readable(1) ;
        >
        > my $serializer = $soap->serializer();
        > $serializer->register( 'http://delegosoftware.com/ns', 'ns' );
        >
        >
        > $serializer->namespaces({
        > "http://schemas.xmlsoap.org/soap/envelope/"=>"soapenv",
        > "http://delegosoftware.com/ns"=>"ns",
        > "http://delegosoftware.com/definitions"=>"def"});
        >
        >
        > my $cardtype = 'Visa' ;
        > my $expdate = '20141231' ;
        > my $cardnum = 'B598A5ED6C7024D3-1111' ;
        > my $nameoncard = 'JOE CONSUMER' ;
        > my $authamount = 150.12 ;
        > my $currency = 'USD' ;
        > my $merchid = 'DEMOMERCHANT' ;
        > my $cvv = 111 ;
        > my $street = '6415 Hwy 70' ;
        > my $zip = 10000 ;
        >
        >
        > my $som = $soap->call('ns:AuthorizationRequest',
        > SOAP::Data->name('def:AuthorizationRequestProcess'
        > => \SOAP::Data->name('def:Authorize' =>
        > \SOAP::Data->name('def:CCAUT' =>
        > \SOAP::Data->value(
        > SOAP::Data->name("def:Ccins" => $cardtype)->type(''),
        > SOAP::Data->name("def:Datbi" => $expdate)->type(''),
        > SOAP::Data->name("def:Ccnum" => $cardnum)->type(''),
        > SOAP::Data->name("def:Ccname" => $nameoncard)->type(''),
        > SOAP::Data->name("def:Autwv" => $authamount)->type('')-
        > >type(''),
        > SOAP::Data->name("def:Ccwae" => $currency)->type(''),
        > SOAP::Data->name("def:Merch" => $merchid)->type(''),
        > SOAP::Data->name("def:Cvval" => $cvv)->type(''),
        > SOAP::Data->name("def:Stras" => $street)->type(''),
        > SOAP::Data->name("def:Pstlz" => $zip)->type('')
        > )
        > ))->attr({encrypt => false,merchant => $merchid})
        > )
        > ) ;
        >
        > +-----------------------------------------------------------
        > Again, nothing particularly involved. But the issue comes with the XML
        this
        > generates:
        >
        > <?xml version="1.0" encoding="UTF-8"?>
        > <soapenv:Envelope
        > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:def="http://delegosoftware.com/definitions"
        > xmlns:ns="http://delegosoftware.com/ns"
        > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        > <soapenv:Body>
        > <ns:AuthorizationRequest xmlns:ns="http://carina.delego.ca:8080">
        > <def:AuthorizationRequestProcess>
        > <def:Authorize encrypt="false" merchant="DEMOMERCHANT">
        > <def:CCAUT>
        > <def:Ccins>Visa</def:Ccins>
        >
        > <def:Datbi>20141231</def:Datbi>
        >
        > <def:Ccnum>B598A5ED6C7024D3-1111</def:Ccnum>
        >
        > <def:Ccname>JOE CONSUMER</def:Ccname>
        >
        > <def:Autwv>150.12</def:Autwv>
        >
        > <def:Ccwae>USD</def:Ccwae>
        >
        > <def:Merch>DEMOMERCHANT</def:Merch>
        >
        > <def:Cvval>111</def:Cvval>
        >
        > <def:Stras>6415 Hwy 70</def:Stras>
        >
        > <def:Pstlz>10000</def:Pstlz>
        > </def:CCAUT>
        > </def:Authorize>
        > </def:AuthorizationRequestProcess>
        > </ns:AuthorizationRequest>
        > </soapenv:Body>
        > </soapenv:Envelope>
        > +---------------------------------------------------------------
        >
        > How can I make SOAPLITE suppress the:
        >
        > xmlns:ns="http://carina.delego.ca:8080
        >
        > or at least the :ns
        >
        > from the
        >
        > <ns:AuthorizationRequest line, so it better matches the SOAPUI example
        which I
        > know works?
        >
        >
        > Cheers,
        >
        > Grant
        >
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.