简体   繁体   中英

Node Soap request to Siebel system

I am building a Node system where as per requirement wsdl from other source(Siebel) is getting consumed. Am using soap npm to build this, but while sending request to Siebel error appears like "Error: Inbound SOAP Message - Session Token is missing or invalid or has expired". Googled it out and looks like related to authentication issue, so added "client.setSecurity(new soap.WSSecurity('username', 'password'))" in the code. Final code looks like as below:

var soap = require('soap');
  var url = 'http___siebel.com_xml_CustomPay_AAA Payment Service BS.WSDL';
var args = {
                amount:'100',
                transactionReference:'abc123',
                orderId:'50',
                customerId:'112211',
                merchantTransactionDateTime:'22/01/2020',
                RequestHeader: {serviceName:'Pay',
                                operation: 'Create',
                                reqSystemName: 'Node',
                                originatorID: '112205',
                                originatorIP: 'aa.aa.aa.aa',
                                hostName: 'siebelbuild'}
                
            }
    
//client.addSoapHeader(RequestHeader,"","tns","http://siebel.com/xml/CustomPay")

  soap.createClient(url, function(err, client) {  
    client.setSecurity(new soap.WSSecurity('username', '****word'))
    client.Upsert1(args, function(err, result) {
        console.log(result);
    });
  });

WSDL file looks like:

<?xml version="1.0" encoding="UTF-8" ?> 
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsdLocal1="http://www.siebel.com/xml/XXXGovPayRequest" targetNamespace="http://siebel.com/xml/CustomPay" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsdLocal2="http://www.siebel.com/xml/XXXGovPayResponse" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://siebel.com/xml/CustomPay">
- <types>
- <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.siebel.com/xml/XXXGovPayResponse" xmlns:xsdLocal2="http://www.siebel.com/xml/XXXGovPayResponse" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:annotation>
  <xsd:documentation>Copyright (C) 2001-2004 Siebel Systems, Inc. All rights reserved. Siebel XSD Generation</xsd:documentation> 
  </xsd:annotation>
  <xsd:element name="XXXGovPayResponse" type="xsdLocal2:XXXGovPayResponse" /> 
+ <xsd:complexType name="XXXGovPayResponseTopElmt">
- <xsd:sequence>
  <xsd:element name="XXXGovPayResponse" maxOccurs="1" minOccurs="1" type="xsdLocal2:XXXGovPayResponse" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="XXXGovPayResponse">
- <xsd:sequence>
  <xsd:element name="OneOffPaymentDetailResponse" maxOccurs="unbounded" minOccurs="1" type="xsdLocal2:OneOffPaymentDetailResponse" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="OneOffPaymentDetailResponse">
- <xsd:sequence>
  <xsd:element name="transactionReference" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="ResponseHeader" maxOccurs="1" minOccurs="0" type="xsdLocal2:ResponseHeader" /> 
  <xsd:element name="Response" maxOccurs="1" minOccurs="0" type="xsdLocal2:Response" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="ResponseHeader">
- <xsd:sequence>
  <xsd:element name="sourceObjectId" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="Response">
+ <xsd:sequence>
  <xsd:element name="responseCode" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="responseMessage" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="ResponseDetails" maxOccurs="1" minOccurs="0" type="xsdLocal2:ResponseDetails" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="ResponseDetails">
- <xsd:sequence>
  <xsd:element name="errorCode" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="errorDescription" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:schema>
- <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xsdLocal1="http://www.siebel.com/xml/XXXGovPayRequest" targetNamespace="http://www.siebel.com/xml/XXXGovPayRequest" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:annotation>
  <xsd:documentation>Copyright (C) 2001-2004 Siebel Systems, Inc. All rights reserved. Siebel XSD Generation</xsd:documentation> 
  </xsd:annotation>
  <xsd:element name="XXXGovPayRequest" type="xsdLocal1:XXXGovPayRequest" /> 
- <xsd:complexType name="XXXGovPayRequestTopElmt">
- <xsd:sequence>
  <xsd:element name="XXXGovPayRequest" maxOccurs="1" minOccurs="1" type="xsdLocal1:XXXGovPayRequest" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="XXXGovPayRequest">
- <xsd:sequence>
  <xsd:element name="oneOffPaymentDetailRequest" maxOccurs="1" minOccurs="1" type="xsdLocal1:oneOffPaymentDetailRequest" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="oneOffPaymentDetailRequest">
- <xsd:sequence>
  <xsd:element name="paymentInputs" maxOccurs="1" minOccurs="1" type="xsdLocal1:paymentInputs" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="paymentInputs">
- <xsd:sequence>
  <xsd:element name="acquirerResponseCode" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="acquirerResponseDescription" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="amount" maxOccurs="1" minOccurs="1" type="xsd:string" /> 
  <xsd:element name="RequestHeader" maxOccurs="1" minOccurs="0" type="xsdLocal1:RequestHeader" /> 
  <xsd:element name="cardScheme" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="chargeAmount" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="creditDebitIndicator" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="maskedPan" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="merchantTransactionDateTime" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="orderAmount" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="responseCode" maxOccurs="1" minOccurs="1" type="xsd:string" /> 
  <xsd:element name="responseDescription" maxOccurs="1" minOccurs="1" type="xsd:string" /> 
  <xsd:element name="transactionDateTime" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="authorizationCode" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="merchantId" maxOccurs="1" minOccurs="1" type="xsd:string" /> 
  <xsd:element name="transactionReference" maxOccurs="1" minOccurs="1" type="xsd:string" /> 
  <xsd:element name="orderId" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="customerId" maxOccurs="1" minOccurs="1" type="xsd:string" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="RequestHeader">
- <xsd:sequence>
  <xsd:element name="serviceName" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="operation" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="reqSystemName" maxOccurs="1" minOccurs="1" type="xsd:string" /> 
  <xsd:element name="originatorID" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="originatorIP" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  <xsd:element name="sourceObjectId" maxOccurs="1" minOccurs="1" type="xsd:string" /> 
  <xsd:element name="hostName" maxOccurs="1" minOccurs="0" type="xsd:string" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:schema>
- <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://siebel.com/xml/CustomPay" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://www.siebel.com/xml/XXXGovPayResponse" /> 
  <xsd:import namespace="http://www.siebel.com/xml/XXXGovPayRequest" /> 
- <xsd:element name="Upsert1_Input">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element ref="xsdLocal1:XXXGovPayRequest" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
- <xsd:element name="Upsert1_Output">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element ref="xsdLocal2:XXXGovPayResponse" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
  </xsd:schema>
  </types>
- <message name="Upsert1_Input">
  <part name="Upsert1_Input" element="tns:Upsert1_Input" /> 
  </message>
- <message name="Upsert1_Output">
  <part name="Upsert1_Output" element="tns:Upsert1_Output" /> 
  </message>
- <portType name="XXXPaymentServiceBS">
- <operation name="Upsert1">
  <input message="tns:Upsert1_Input" /> 
  <output message="tns:Upsert1_Output" /> 
  </operation>
  </portType>
- <binding name="XXXPaymentServiceBS" type="tns:XXXPaymentServiceBS">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> 
- <operation name="Upsert1">
  <soap:operation soapAction="document/http://siebel.com/xml/CustomPay:Upsert1" /> 
- <input>
  <soap:body use="literal" /> 
  </input>
- <output>
  <soap:body use="literal" /> 
  </output>
  </operation>
  </binding>
- <service name="XXX_spcPayment_spcService_spcBS">
- <port binding="tns:XXXPaymentServiceBS" name="XXXPaymentServiceBS">
  <soap:address location="http://aa.aa.bb.bb.:8080/eai_enu/start.swe?SWEExtSource=WebService&SWEExtCmd=Execute&WSSOAP=1" /> 
  </port>
  </service>
  </definitions>

Also imported the wsdl in soapUI tool to check but result is same. Could someone please help.

Depends on how the provider has setup the security. Try passing userid and password as SOAP headers. Try these soap headers

<UsernameToken>{username}</UsernameToken>
<PasswordText>{password}<PasswordText>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM