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

6612Would REALLY appreciate help - new to SOAPLite

Expand Messages
  • grantcblair
    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
    • Show all 2 messages in this topic