We just started developing our own sabre app and we are trying to create a session to proceed with other services.
But an exception returned :
com.sabre.universalservices.base.exception.ApplicationException: errors.general.USG_COULD_NOT_COMPLETE_REQUEST
This is the code used :
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:eb='http://www.ebxml.org/namespaces/messageHeader' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
<SOAP-ENV:Header>
<eb:MessageHeader SOAP-ENV:mustUnderstand='1' eb:version='1.0'>
<eb:ConversationId>*myConversationId*</eb:ConversationId>
<eb:From>
<eb:PartyId type='urn:x12.org:IO5:01'>999999</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId type='urn:x12.org:IO5:01'>123123</eb:PartyId>
</eb:To>
<eb:CPAId>IPCC</eb:CPAId>
<eb:Service eb:type='OTA'>SessionCreateRQ</eb:Service>
<eb:Action>SessionCreateRQ</eb:Action>
<eb:MessageData>
<eb:MessageId>1000</eb:MessageId>
<eb:Timestamp>2016-04-06T01:14:12Z</eb:Timestamp>
<eb:TimeToLive>2016-04-06T02:14:12Z</eb:TimeToLive>
</eb:MessageData>
</eb:MessageHeader>
<wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext' xmlns:wsu='http://schemas.xmlsoap.org/ws/2002/12/utility'>
<wsse:UsernameToken>
<wsse:Username>*Username*</wsse:Username>
<wsse:Password>*Password*</wsse:Password>
<Organization>IPCC;</Organization>
<Domain>DEFAULT</Domain>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<eb:Manifest SOAP-ENV:mustUnderstand='1' eb:version='1.0'>
<eb:Reference xmlns:xlink='http://www.w3.org/1999/xlink' xlink:href='cid:rootelement' xlink:type='simple'/>
</eb:Manifest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And here is the returned response :
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<DataSet xmlns="http://tempuri.org/">
<xs:schema xmlns:mstns="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:app1="http://www.ebxml.org/namespaces/messageHeader" xmlns:app2="http://schemas.xmlsoap.org/ws/2002/12/secext" id="Envelope" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:import namespace="http://www.ebxml.org/namespaces/messageHeader"/>
<xs:import namespace="http://schemas.xmlsoap.org/ws/2002/12/secext"/>
<xs:attribute name="mustUnderstand" msdata:Prefix="soap-env" type="xs:string"/>
<xs:element name="Envelope" msdata:IsDataSet="true" msdata:Locale="en-US" msdata:Prefix="soap-env">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="app1:PartyId"/>
<xs:element name="Header" msdata:Prefix="soap-env">
<xs:complexType>
<xs:sequence>
<xs:element ref="app2:Security" minOccurs="0"/>
<xs:element ref="app1:MessageHeader"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Body" msdata:Prefix="soap-env">
<xs:complexType>
<xs:sequence>
<xs:element name="Fault" msdata:Prefix="soap-env" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="faultcode" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="faultstring" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="detail" form="unqualified">
<xs:complexType>
<xs:sequence>
<xs:element name="StackTrace" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:mstns="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:app2="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:app1="http://www.ebxml.org/namespaces/messageHeader" targetNamespace="http://schemas.xmlsoap.org/ws/2002/12/secext" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:import namespace="http://www.ebxml.org/namespaces/messageHeader"/>
<xs:import namespace="http://schemas.xmlsoap.org/soap/envelope/"/>
<xs:element name="Security" msdata:Prefix="wsse" type="xs:string"/>
</xs:schema>
<xs:schema xmlns:mstns="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.ebxml.org/namespaces/messageHeader" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:app1="http://www.ebxml.org/namespaces/messageHeader" xmlns:app2="http://schemas.xmlsoap.org/ws/2002/12/secext" targetNamespace="http://www.ebxml.org/namespaces/messageHeader" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:import namespace="http://schemas.xmlsoap.org/soap/envelope/"/>
<xs:import namespace="http://schemas.xmlsoap.org/ws/2002/12/secext"/>
<xs:element name="PartyId" msdata:Prefix="eb" nillable="true">
<xs:complexType>
<xs:simpleContent msdata:Prefix="eb" msdata:ColumnName="PartyId_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="type" msdata:Prefix="eb" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="MessageHeader" msdata:Prefix="eb">
<xs:complexType>
<xs:sequence>
<xs:element name="CPAId" msdata:Prefix="eb" type="xs:string" minOccurs="0" msdata:Ordinal="1"/>
<xs:element name="ConversationId" msdata:Prefix="eb" type="xs:string" minOccurs="0" msdata:Ordinal="2"/>
<xs:element name="Action" msdata:Prefix="eb" type="xs:string" minOccurs="0" msdata:Ordinal="3"/>
<xs:element name="From" msdata:Prefix="eb" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element ref="PartyId" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="To" msdata:Prefix="eb" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element ref="PartyId" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Service" msdata:Prefix="eb" nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent msdata:Prefix="eb" msdata:ColumnName="Service_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="type" msdata:Prefix="eb" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="MessageData" msdata:Prefix="eb" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="MessageId" msdata:Prefix="eb" type="xs:string" minOccurs="0"/>
<xs:element name="Timestamp" msdata:Prefix="eb" type="xs:string" minOccurs="0"/>
<xs:element name="RefToMessageId" msdata:Prefix="eb" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="version" msdata:Prefix="eb" type="xs:string"/>
<xs:attribute ref="mstns:mustUnderstand"/>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header diffgr:id="Header1" msdata:rowOrder="0" diffgr:hasChanges="inserted" msdata:hiddenHeader_Id="0">
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext"/>
<eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" diffgr:id="MessageHeader1" msdata:rowOrder="0" diffgr:hasChanges="inserted" msdata:hiddenMessageHeader_Id="0" eb:version="1.0" soap-env:mustUnderstand="1" msdata:hiddenHeader_Id="0">
<eb:CPAId>IPCC</eb:CPAId>
<eb:ConversationId>www.tiitco.com10:16</eb:ConversationId>
<eb:Action>ErrorRS</eb:Action>
<eb:From diffgr:id="From1" msdata:rowOrder="0" diffgr:hasChanges="inserted" msdata:hiddenFrom_Id="0" msdata:hiddenMessageHeader_Id="0">
<eb:PartyId diffgr:id="PartyId1" msdata:rowOrder="0" diffgr:hasChanges="inserted" eb:type="URI" msdata:hiddenFrom_Id="0">123123</eb:PartyId>
</eb:From>
<eb:To diffgr:id="To1" msdata:rowOrder="0" diffgr:hasChanges="inserted" msdata:hiddenTo_Id="0" msdata:hiddenMessageHeader_Id="0">
<eb:PartyId diffgr:id="PartyId2" msdata:rowOrder="1" diffgr:hasChanges="inserted" eb:type="URI" msdata:hiddenTo_Id="0">999999</eb:PartyId>
</eb:To>
<eb:Service diffgr:id="Service1" msdata:rowOrder="0" diffgr:hasChanges="inserted" eb:type="OTA" msdata:hiddenMessageHeader_Id="0">SessionCreateRQ</eb:Service>
<eb:MessageData diffgr:id="MessageData1" msdata:rowOrder="0" diffgr:hasChanges="inserted" msdata:hiddenMessageHeader_Id="0">
<eb:MessageId>b00c9239-c921-4983-a8ed-831732f54b84#176</eb:MessageId>
<eb:Timestamp>2016-04-06T07:19:41</eb:Timestamp>
<eb:RefToMessageId>1000</eb:RefToMessageId>
</eb:MessageData>
</eb:MessageHeader>
</soap-env:Header>
<soap-env:Body diffgr:id="Body1" msdata:rowOrder="0" diffgr:hasChanges="inserted" msdata:hiddenBody_Id="0">
<soap-env:Fault diffgr:id="Fault1" msdata:rowOrder="0" diffgr:hasChanges="inserted" msdata:hiddenFault_Id="0" msdata:hiddenBody_Id="0">
<faultcode xmlns="">soap-env:Server.SystemFailure</faultcode>
<faultstring xmlns="">SOAPException: Could not complete the request</faultstring>
<detail xmlns="" diffgr:id="detail1" msdata:rowOrder="0" diffgr:hasChanges="inserted" msdata:hiddenFault_Id="0">
<StackTrace>
com.sabre.universalservices.base.exception.ApplicationException: errors.general.USG_COULD_NOT_COMPLETE_REQUEST
</StackTrace>
</detail>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope>
</diffgr:diffgram>
</DataSet>
Does anyone have an idea on what could be the problem?
The returned response looks more like a schema declaration in an xsd file.
Is that what you are getting back?
Anyway, the error USG_COULD_NOT_COMPLETE_REQUEST is included on the error codes list:
https://developer.sabre.com/docs/read/soap_basics/status_codes_and_errors
What is the endpoint you are trying to hit?
Customer Acceptance Testing/CERT?
https://developer.sabre.com/docs/read/soap_basics/environments
Are you using a SOAP client tool? Any language?
More info will help.
This seems like an authentication error of some sorts. Here is some working XML for creating a session, compare. Like fcarreno said you are likely missing the PseudoCityCode node.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<MessageHeader xmlns="http://www.ebxml.org/namespaces/messageHeader">
<From>
<PartyId type="urn:x12.org:IO5:01">*or</PartyId>
</From>
<To>
<PartyId type="urn:x12.org:IO5:01">Sabre</PartyId>
</To>
<CPAId>X2TH</CPAId>
<ConversationId>1473816876</ConversationId>
<Service type="sabreXML">SessionCreateRQ</Service>
<Action>SessionCreateRQ</Action>
<MessageData>
<MessageId>1473816876</MessageId>
<Timestamp>2016-09-14T01:34:36</Timestamp>
<TimeToLive>2016-09-14T02:34:36</TimeToLive>
</MessageData>
</MessageHeader>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/12/utility">
<wsse:UsernameToken>
<wsse:Username>*user</wsse:Username>
<wsse:Password>*pass</wsse:Password>
<Organization>*ipcc</Organization>
<Domain>DEFAULT</Domain>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<SessionCreateRQ xmlns="http://www.opentravel.org/OTA/2002/11">
<POS>
<Source PseudoCityCode="*ipcc" />
</POS>
</SessionCreateRQ>
</soapenv:Body>
</soapenv:Envelope>
Related
I have to generate a CSV file without the header line.
So I created the following xsd :
<?xml version="1.0" encoding="utf-16" ?>
<xs:schema xmlns="http://Person.Schemas.Person_Export" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Person.Schemas.Person_Export" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Person_Export" default_pad_char="" pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false"/>
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="Person_Export">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="postfix"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="Person">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_delimiter_type="char" child_delimiter="," child_order="infix"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0"/>
</xs:appinfo>
</xs:annotation>
<xs:element minOccurs="1" name="over_start_date" type="xs:date">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" datetime_format="dd-MM-yyyy" sequence_number="1"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="over_end_date" type="xs:date">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="2" justification="left" datetime_format="dd-MM-yyyy"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="emp_name" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="3" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="emp_lastname" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="4" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="emp_firstname" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="5" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="EMP_UDF_DATA1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="6" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="EMP_UDF_DATA2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="7" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="EMP_UDF_DATA3" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="8" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="emp_birth_date" type="xs:date">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="9" justification="left" datetime_format="dd-MM-yyyy"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="EMP_HIRE_DATE" type="xs:date">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="10" justification="left" datetime_format="dd-MM-yyyy"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" default="1" name="WBU_PASSWORD" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="11" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="WBU_EMAIL" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="12" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="WBU_NAME" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="13" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" default="NL OFFICERS" name="WBG_ID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="14" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" default="Dutch" name="WBLL_ID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="15" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="USER_STATUS" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="16" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" default="N" name="WBU_CAN_PROXY" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="17" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" default="999999" name="EMP_SIN" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="18" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="1" name="EMP_VAL20" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="19" justification="left"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The file is generated correctly :
<ns0:Person_Export xmlns:ns0="http://Person.Schemas.Person_Export">
<Person>
<over_start_date>26-11-2022</over_start_date>
<over_end_date/>
<emp_name>000123</emp_name>
<emp_lastname>test</emp_lastname>
<emp_firstname>test</emp_firstname>
<EMP_UDF_DATA1/>
<EMP_UDF_DATA2>+312345678</EMP_UDF_DATA2>
<EMP_UDF_DATA3>012345678</EMP_UDF_DATA3>
<emp_birth_date>29-04-1976</emp_birth_date>
<EMP_HIRE_DATE>03-02-2000</EMP_HIRE_DATE>
<WBU_PASSWORD>1</WBU_PASSWORD>
<WBU_EMAIL>test#hotmail.com</WBU_EMAIL>
<WBU_NAME>000123</WBU_NAME>
<WBG_ID>NL OFFICERS</WBG_ID>
<WBLL_ID>Dutch</WBLL_ID>
<USER_STATUS/>
<WBU_CAN_PROXY>N</WBU_CAN_PROXY>
<EMP_SIN>999999</EMP_SIN>
<EMP_VAL20>M</EMP_VAL20>
</Person>
</ns0:Person_Export>
But the pipeline return this error :
Unable to read the stream produced by the pipeline.
Details: Value cannot be null.
Parameter name: format
The fields over_end_date, EMP_UDF_DATA1 and USER_STATUS must be blank in the output so in the mapping I setted the Value property to empty.
I tested this solution but doesn't resolved my issue.
Ok I managed to find a solution by changing the date type to string type.
The fact that some date in my output must be empty was the reason for this error.
I have a XML data source like below:
<xs:element name="block" type="xs:string" minOccurs="0" />
<xs:element name="lot" type="xs:string" minOccurs="0" />
<xs:element name="wafer" type="xs:string" minOccurs="0" />
Now I want to create a formula which need all block+lot as a string with each record as a single line.
so suppose the data is
<xs:element name="block" type="xs:string" minOccurs="0" >A1</block>
<xs:element name="lot" type="xs:string" minOccurs="0" >B1</lot>
<xs:element name="wafer" type="xs:string" minOccurs="0" >C1</wafer>
<xs:element name="block" type="xs:string" minOccurs="0" >A2</block>
<xs:element name="lot" type="xs:string" minOccurs="0" >B2</lot>
<xs:element name="wafer" type="xs:string" minOccurs="0" >C2</wafer>
then the result string is A1B1/nA2B2
How to do it?I tried to use variable and while do loop, but how to let the variable point to next record? Thx.
following xsd (partial):
<xs:complexType name="Fruit">
<xs:sequence>
<xs:element name="type" type="FruitType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="FruitType">
<xs:restriction base="xs:string">
<xs:enumeration value="ABC">
</xs:enumeration>
<xs:enumeration value="DEF">
</xs:enumeration>
<xs:enumeration value="GHI">
</xs:enumeration>
<xs:enumeration value="JKL">
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
Generating code with xjc will generate the following java code (FruitType is an Enum):
#XmlElement(required = true)
#XmlSchemaType(name = "string")
protected FruitType fruit;
When generating a SOAP WebService with JAX-WS the following element will be generated:
<xs:element name="type" type="xs:string"/>
Which ist obviously wrong. I'd expect this to be
<xs:element name="type" type="FruitType"/>
If I delete this line by hand
#XmlSchemaType(name = "string")
in my Java Code everything in the wsdl is fine :
<xs:element name="type" type="tns:FruitType"/>
So the question is: How can I tell JAXB not to generate the #XmlSchemaType?
Instead of referencing FruitType with type
<xs:complexType name="Fruit">
<xs:sequence>
<xs:element name="type" type="FruitType"/>
</xs:sequence>
</xs:complexType>
the trick ist to have a simpleType inline:
<xs:complexType name="Fruit">
<xs:sequence>
<xs:element name="type">
<xs:simpleType>
<xs:restriction base="FruitType"/>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
this will generate the correct java file and WSDL:
<xs:element name="type" type="tns:FruitType"/>
I have at my hands a SOAP API that has plenty of functionality, but from which I only need two methods: adding user to a database and deleting user from a database.
Currently I am locked to Perl as the language for this task.
Because deleting a user takes in as the only parameter the "id" of the user (not "userId" as in username), I need to define it myself rather than relying on MySQL's auto_increment.
Relevant parts from the WSDL:
<xs:element name="saveLocalUserEx">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="user" nillable="true" type="ns2:LocalUser"/>
<xs:element minOccurs="0" name="requestingUser" nillable="true" type="xs:string"/></xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="LocalUser">
<xs:sequence>
<xs:element minOccurs="0" name="dbData" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="displayName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="domainName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="enabled" type="xs:boolean"/>
<xs:element minOccurs="0" name="firstName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="id" nillable="true" type="xs:long"/>
<xs:element minOccurs="0" name="lastName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="loginId" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="loginPasswordHash" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="loginPasswordHashType" type="xs:int"/>
<xs:element minOccurs="0" name="preOrSelfProvisioned" type="xs:boolean"/>
<xs:element minOccurs="0" name="DEFAULT_PASSWORD_HASH_TYPE" type="xs:int"/>
<xs:element minOccurs="0" name="PKCS5_REVERSIBLE_HASH_TYPE" type="xs:int"/>
<xs:element minOccurs="0" name="SHA1_NON_REVERSIBLE_HASH_TYPE" type="xs:int"/>
<xs:element minOccurs="0" name="STR_DEFAULT_ADMIN_NAME" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="STR_DEFAULT_DOMAIN" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="STR_DEFAULT_SPONSOR_NAME" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
Here are (relevant parts) of the code I first wrote.
my $soap = SOAP::Lite
->uri($uri)
->proxy($proxy);
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return 'abc' => 'abc';
}
my $test_id = 1515;
# Preparing data for API query for saving the new user.
my $data = SOAP::Data->name("LocalUser" =>
\SOAP::Data->value(
SOAP::Data->name("loginId" => $new_username),
SOAP::Data->name("enabled" => true),
SOAP::Data->name("domainName" => $domainname),
SOAP::Data->name("loginPasswordHash" => $hash),
SOAP::Data->name("id" => $test_id),
SOAP::Data->name("description" => 'Guest User Account generated on: ' . localtime()),
SOAP::Data->name("displayName" => 'Guest')
)
);
my $som = $soap->saveLocalUserEx($data);
print Dumper $som->result();
It almost does the job. In the matter of fact; API accepts this query, result is success and a new user is generated. The problem is, that id field in the database is still MySQL auto_incremented, and not 1515 I tried to give it this time. Then I started thinking that maybe I need to type the parameter explicitly to long, because wsdl states the type for id is xs:long.
I've tried modifying my code with:
SOAP::Data->type('xs:long')->name("id" => $test),
and
SOAP::Data->type('long')->name("id" => $test),
But these didn't help. API query succeeds, but id is not made to 1515.
Do you guys have any idea how to make this work? Thanks!
I need to validate an XML file and using eclipse to do it. I've added the XML file and all XSD file to a project:
I've added a reference to the XSD file:
<?xml version="1.0" encoding="UTF-8"?>
<S2SDDDnf:MPEDDDnfBlkDirDeb xmlns = "MPEDDDnfBlkDirDeb.xsd">
<S2SDDDnf:SndgInst>stuff</S2SDDDnf:SndgInst>
<S2SDDDnf:RcvgInst>stuff</S2SDDDnf:RcvgInst>
<S2SDDDnf:SrvcId>COR</S2SDDDnf:SrvcId>
<S2SDDDnf:TstCode>T</S2SDDDnf:TstCode>
<S2SDDDnf:FType>DNF</S2SDDDnf:FType>
<S2SDDDnf:FileRef>DNFMJMD%R5%LXXX</S2SDDDnf:FileRef>
<S2SDDDnf:FileBusDt>2013-10-18</S2SDDDnf:FileBusDt>
<S2SDDDnf:RoutingInd>ALL</S2SDDDnf:RoutingInd>
<S2SDDDnf:FileCycleNo>01</S2SDDDnf:FileCycleNo>
<S2SDDDnf:NumDDBlk>1</S2SDDDnf:NumDDBlk>
<S2SDDDnf:NumPCRBlk>0</S2SDDDnf:NumPCRBlk>
<S2SDDDnf:NumREJBlk>0</S2SDDDnf:NumREJBlk>
<S2SDDDnf:FIToFICstmrDrctDbt xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.003.001.02"
xmlns:S2SDDDnf="urn:S2SDDDnf:xsd:$MPEDDDnfBlkDirDeb">
<GrpHdr>
<MsgId>DNF.UAIAO47X2B</MsgId>
<CreDtTm>2013-10-18T15:40:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<TtlIntrBkSttlmAmt Ccy="EUR">1025.00</TtlIntrBkSttlmAmt>
<IntrBkSttlmDt>2013-10-22</IntrBkSttlmDt>
<SttlmInf>
<SttlmMtd>CLRG</SttlmMtd>
<ClrSys>
<Prtry>ST2</Prtry>
</ClrSys>
</SttlmInf>
<InstdAgt>
<FinInstnId>
<BIC>stuff</BIC>
</FinInstnId>
</InstdAgt>
</GrpHdr>
<DrctDbtTxInf>
<PmtId>
<InstrId>DDPreTest18</InstrId>
<EndToEndId>TS141GENR-ZLDL%R5%WXXX</EndToEndId>
<TxId>TRXID01.R8NRO%R4%D</TxId>
</PmtId>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
<LclInstrm>
<Cd>CORE</Cd>
</LclInstrm>
<SeqTp>OOFF</SeqTp>
</PmtTpInf>
<IntrBkSttlmAmt Ccy="EUR">1025.00</IntrBkSttlmAmt>
<ChrgBr>SLEV</ChrgBr>
<ReqdColltnDt>2013-10-22</ReqdColltnDt>
<DrctDbtTx>
<MndtRltdInf>
<MndtId>Mndt141.001b</MndtId>
<DtOfSgntr>2013-09-16</DtOfSgntr>
<AmdmntInd>false</AmdmntInd>
<AmdmntInfDtls>
<OrgnlCdtrSchmeId>
<Id>
<PrvtId>
<Othr>
<Id></Id>
</Othr>
</PrvtId>
</Id>
</OrgnlCdtrSchmeId>
</AmdmntInfDtls>
</MndtRltdInf>
<CdtrSchmeId>
<Id>
<PrvtId>
<Othr>
<Id>stuff</Id>
<SchmeNm><Prtry>SEPA</Prtry></SchmeNm>
</Othr>
</PrvtId>
</Id>
</CdtrSchmeId>
</DrctDbtTx>
<Cdtr>
<Nm>stuff</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>stuff</IBAN>
</Id>
</CdtrAcct>
<CdtrAgt>
<FinInstnId>
<BIC>stuff</BIC>
</FinInstnId>
</CdtrAgt>
<Dbtr>
<Nm>stuff</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>stuff</IBAN>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC>stuff</BIC>
</FinInstnId>
</DbtrAgt>
<RmtInf>
<Ustrd>Pre-testing SEPA Direct Debits</Ustrd>
</RmtInf>
</DrctDbtTxInf>
</S2SDDDnf:FIToFICstmrDrctDbt>
</S2SDDDnf:MPEDDDnfBlkDirDeb>
And this is the XSD:
<?xml version="1.0" encoding="UTF-8"?>
<!-- STEP2 SDD Schema, MPEDDDnfBlkDirDeb, May 25th 2012, Release November 2012 -->
<!-- STEP2 SDD Shift camt.056 after pacs.003 in sequence and counter, February 25th 2010 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sw3="urn:iso:std:iso:20022:tech:xsd:pacs.003.001.02" xmlns:sw2="urn:iso:std:iso:20022:tech:xsd:pacs.002.001.03" xmlns:sw6="urn:iso:std:iso:20022:tech:xsd:camt.056.001.01" xmlns:S2SDDDnf="urn:S2SDDDnf:xsd:$MPEDDDnfBlkDirDeb" targetNamespace="urn:S2SDDDnf:xsd:$MPEDDDnfBlkDirDeb" elementFormDefault="qualified">
<xs:import namespace="urn:iso:std:iso:20022:tech:xsd:pacs.003.001.02" schemaLocation="pacs.003.001.02.xsd"/>
<xs:import namespace="urn:iso:std:iso:20022:tech:xsd:pacs.002.001.03" schemaLocation="pacs.002.001.03.xsd"/>
<xs:import namespace="urn:iso:std:iso:20022:tech:xsd:camt.056.001.01" schemaLocation="camt.056.001.01.xsd"/>
<xs:element name="MPEDDDnfBlkDirDeb">
<xs:complexType>
<xs:sequence>
<xs:element name="SndgInst" type="sw3:BICIdentifier"/>
<xs:element name="RcvgInst" type="sw3:BICIdentifier"/>
<!-- changed from SrvcID to SrvcId, Febrary 12 2009 -->
<xs:element name="SrvcId" type="S2SDDDnf:SrvcID"/>
<xs:element name="TstCode" type="S2SDDDnf:TestCodeType"/>
<xs:element name="FType" type="S2SDDDnf:FTpType"/>
<xs:element name="FileRef" type="S2SDDDnf:Max16Text"/>
<xs:element name="FileBusDt" type="sw2:ISODate"/>
<xs:element name="RoutingInd" type="S2SDDDnf:RoutingInd"/>
<xs:element name="FileCycleNo" type="S2SDDDnf:Max2NumericText"/>
<xs:element name="NumDDBlk" type="S2SDDDnf:Max8NumericText"/>
<xs:element name="NumPCRBlk" type="S2SDDDnf:Max8NumericText"/>
<xs:element name="NumREJBlk" type="S2SDDDnf:Max8NumericText"/>
<xs:element name="FIToFICstmrDrctDbt" type="sw3:FIToFICustomerDirectDebitV02" minOccurs="0" maxOccurs="unbounded"/>
<!--camt.056.001.01 replace pacs.006.001.02, January 20th 2010 -->
<xs:element name="FIToFIPmtCxlReq" type="sw6:FIToFIPaymentCancellationRequestV01" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="FIToFIPmtStsRpt" type="sw2:FIToFIPaymentStatusReportV03" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="Max16Text">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9A-Z]{16,16}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SrvcID">
<xs:restriction base="xs:string">
<xs:enumeration value="COR"/>
<xs:enumeration value="B2B"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="FTpType">
<xs:restriction base="xs:string">
<xs:enumeration value="DNF"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TestCodeType">
<xs:restriction base="xs:string">
<xs:length value="1"/>
<xs:enumeration value="T"/>
<xs:enumeration value="P"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Max8NumericText">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{1,8}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RoutingInd">
<xs:restriction base="xs:string">
<xs:length value="3" fixed="true"/>
<xs:enumeration value="DIR"/>
<xs:enumeration value="IND"/>
<xs:enumeration value="ALL"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Max2NumericText">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{2,2}"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
And getting this error:
The prefix "S2SDDDnf" for element "S2SDDDnf:MPEDDDnfBlkDirDeb" is not bound. SDDCoreTest18.xml /XMLValidation line 2 XML Problem
Edit
Organize the XSD files in separate folder:
You need to add a definition of the S2SDDDnf alias like so:
<S2SDDDnf:MPEDDDnfBlkDirDeb xmlns = "MPEDDDnfBlkDirDeb.xsd" xmlns:S2SDDDnf="urn:S2SDDDnf:xsd:$MPEDDDnfBlkDirDeb">...</S2SDDDnf:MPEDDDnfBlkDirDeb>
Try creating a XML file referencing the XSD using the New XML File wizard.