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>
Related
I've a WSDL XSD with request & response complex type elements defined.
<xsd:complexType name="authPartyRequest">
<xsd:sequence>
<xsd:element name="Party" type="ICI-CAAS:Party" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Address" type="ICI-CAAS:Address" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
<xsd:complexType>
<xsd:complexType name="authPartyResponse">
<xsd:sequence>
<xsd:element name="Channel" type="ICI-CAAS:Channel" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Event" type="ICI-CAAS:Event" minOccurs="0" maxOccurs="1"/>
<xsd:element name="Party" type="ICI-CAAS:Party" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:complexType>
and WSDL has portType definition including
<wsdl:operation name="authenticateParty">
<wsdl:input message="ICI-CAAS:authPartyRequst" />
<wsdl:output message="ICI-CAAS:authPartyResponse" /> --> method response type
</wsdl:operation>
When I generate the stubs using JAX-RPC (with WAS 6.1 run time) I'm seeing port type interface is generated with operation having response as 'void'. How ever I see request parameter is passed correctly.
public interface AuthManagerService_PortType extends java.rmi.Remote
{
public void authenticateParty(AuthPartyRequest req); --> generating response type 'void'
}
Can any one please help on priority?
In the below xsd, I want to make the EDI_DC element as mandatory.I tried by using minOccurs="1" and nillable="false" but it is not working.
please suggest me any other way here to make this element as mandatory.
xsd:
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
xmlns:tns="http://TargetNamespace.com/sdg"
targetNamespace="http://www.oracle.com/ias/processconnect"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
nxsd:stream="chars"
nxsd:version="NXSD">
<xsd:element name="Root-Element">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="EDI_DC" nxsd:startsWith="EDI_DC" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="tabnam"
type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="4"
/>
<xsd:element name="mandt"
type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="3"
/>
<xsd:element name="docnum"
type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="16"
/>
<xsd:element name="docrel"
type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="4"
/>
<xsd:element name="EDI_DCeol"
type="xsd:string"
nxsd:style="terminated"
nxsd:terminatedBy="${eol}" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="E2EDL20" nxsd:startsWith="E2EDL20">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="segnam_ver" type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="23"
/>
<xsd:element name="mandt" type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="3" />
<xsd:element name="docnum" type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="16" />
<xsd:element name="E2EDL20EOL" type="xsd:string"
nxsd:style="terminated"
nxsd:terminatedBy="${eol}"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
folks, i need your help with the following.
my xml looks like this:
<Images>
<Image ImageId="1" ImageFile="a.png"/>
<Image ImageId="2" ImageFile="b.png"/>
<Image ImageId="3" ImageFile="c.png"/>
<Image ImageId="4" ImageFile="d.png"/>
<Image ImageId="5" ImageFile="e.png"/>
</Images>
<Banners>
<Banner BannerId="1" ImageId="2"/>
<Banner BannerId="43" ImageId="3"/>
<Banner BannerId="45" ImageId="4"/>
<Banner BannerId="596" ImageId="2"/>
<Banner BannerId="6" ImageId="2"/>
</Banners>
i need to create an xsd that will restrict ImageId values in Banner elements to those appearing in Images. Is it possible?
Yes; the XML schema components you need are key/keyref:
<?xml version="1.0" encoding="utf-8"?>
<!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="sample">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Images">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Image">
<xsd:complexType>
<xsd:attribute name="ImageId" type="xsd:unsignedByte" use="required"/>
<xsd:attribute name="ImageFile" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Banners">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Banner">
<xsd:complexType>
<xsd:attribute name="BannerId" type="xsd:unsignedShort" use="required"/>
<xsd:attribute name="ImageId" type="xsd:unsignedByte" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:key name="PK">
<xsd:selector xpath="Images/Image"/>
<xsd:field xpath="#ImageId"/>
</xsd:key>
<xsd:keyref name="FK" refer="PK">
<xsd:selector xpath="Banners/Banner"/>
<xsd:field xpath="#ImageId"/>
</xsd:keyref>
</xsd:element>
</xsd:schema>
Sample error message:
The key sequence '8' in Keyref fails to refer to some key.
xsd-restriction-by-value.xml is XSD 1.0 invalid.
i trying the following but getting an error
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsd:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml.xsd" />
<xsd:element name="book" type="bookType"/>
<xsd:complexType name="bookType">
<xsd:all>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="author" type="xsd:string"/>
<xsd:element ref="xhtml:pre"/>
<xsd:element ref="xhtml:ul"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
its returning an error on <xsd:element ref="xhtml:pre"/>
Try this:
<xsd:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd" />
Instead of your import. It will validate in XML Spy.
This is my xml (not whole):
<xsd:complexType name="xx">
<xsd:complexContent>
<xsd:extension base="tns:xx">
<xsd:sequence>
<xsd:element name="rekVrednostDdv" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="dateTime"/>
<xsd:element name="xx" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="dateTime"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="tns:xx"/>
<xsd:element name="xx" nillable="true" type="dateTime"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
For example rekVrednostDdv must have precision 2. How can i tell this type to have precision 2.
i try like this:
<xsd:element name="rekVrednostDdv" nillable="true">
<xsd:simpleType>
<xsd:restriction base="decimal">
<xsd:precision value="6"/>
<xsd:scale value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
but now i get when using http://www.brainbell.com/tutorials/XML/Working_With_Simple_Types.htm
Invalid XML schema: 'Element <xsd:precision> is not allowed under element <xsd:restriction>.'
Create a new simple type that restricts xs:decimal and use <xs:fractionDigits/> to define the precision. Then refer to this type in your element definition.
<xs:simpleType name="decimalTwoPrec">
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2" />
</xs:restriction>
</xs:simpleType>
<xs:element name="rekVrednostDdv" nillable="true" type="decimalTwoPrec"/>
For more info, see the spec http://www.w3.org/TR/xmlschema-2/#rf-fractionDigits