2 Replies Latest reply: Feb 6, 2013 6:46 AM by 735835 RSS

    XML Response Message difficulty, Please help..

    956924
      I am working on a request as well as a response message and am having some difficulty on the response side of things. The general task is an inbound interface that consumes an XML file, and then send a message back to the source sytem with a confirmation or error. The consume part is working at this point. Here are the details on my response..

      Message xsd schema...
      <?xml version="1.0"?>
      <xs:schema targetNamespace="http://mdcourts.backoffice.jaxb" version="1.0" xmlns:tns="http://mdcourts.backoffice.jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="PaymentTransactionsMessage">
      <xs:complexType>
      <xs:sequence>
      <xs:element form="qualified" maxOccurs="unbounded" name="PaymentData" type="tns:PaymentDataType"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      <xs:element name="PaymentTransactionsResponseMessage" nillable="true">
      <xs:complexType>
      <xs:sequence>
      <xs:element form="qualified" name="ResponseMessage" type="tns:ResponseMessageType"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      <xs:complexType name="ResponseMessageType">
      <xs:sequence>
      <xs:element name="ReturnResult" type="xs:string"/>
      </xs:sequence>
      </xs:complexType>
      </xs:schema>

      PeopleCode in my App Pack specific to response only...
      &response = CreateMessage(Operation.AOC_PYMNT_TRANS, %IntBroker_Response);
      &xmlrespdata = "<?xml version='1.0'?>";
      &xmldoc = CreateXmlDoc(&xmlrespdata);

      &rootnode = &xmldoc.DocumentElement.AddElement("ResponseMessage");
      &childnode = &rootnode.AddElement("ReturnResult");
      &textnode = &childnode.AddText(String(&County));

      &response.SetXmlDoc(&xmldoc);
      Return &response

      I am using SOAPui to test this and am getting an 'Invalid Document Structure' on the response side.

      Here is the error returned in SOAP...
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
      <faultcode>SOAP-ENV:Server</faultcode>
      <faultstring>null</faultstring>
      <detail>
      <IBResponse type="error">
      <DefaultTitle>Integration Broker Response</DefaultTitle>
      <StatusCode>20</StatusCode>
      <MessageID>5</MessageID>
      <DefaultMessage>XML parser error CreateXmlDoc Fatal Error: at file Integration Server line: 1 column: 22 message: Invalid document structure (159,5) AOC_IB_APP_PACK.AOC_IB_PROCESSING.OnExecute Name:OnRequest PCPC:12415 Statement:210</DefaultMessage>
      <MessageParameters>
      <Parameter>CreateXmlDoc</Parameter>
      <Parameter>Fatal Error: at file Integration Server line: 1 column: 22 message: Invalid document structure</Parameter>
      </MessageParameters>
      </IBResponse>
      </detail>
      </SOAP-ENV:Fault>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      Thank you very much for the help.
        • 1. Re: XML Response Message difficulty, Please help..
          HakanBiroglu
          your code contains a few errors
          >
          &xmlrespdata = "<?xml version='1.0'?>";
          &xmldoc = CreateXmlDoc(&xmlrespdata);
          >
          add a root element to the createxmldoc
          &xmlrespdata = "<?xml version='1.0'?><ResponseMessage/>";
          &xmldoc = CreateXmlDoc(&xmlrespdata);
          or use CreateDocumentElement() to add a root after creating a empty xmldoc

          >
          &rootnode = &xmldoc.DocumentElement.AddElement("ResponseMessage");
          >
          judging by your name &rootnode I think you want to create root element, whereas &xmldoc.DocumentElement is already your root node. With &xmldoc.DocumentElement.AddElement("ResponseMessage"); you add a new element under the root node.

          Please have a look at a tutorial a posted on working with Integration Broker and how to handle webservices.
          http://bloggingaboutoracleapplications.org/integration-broker-basics-peoplesoft-developer/
          • 2. Re: XML Response Message difficulty, Please help..
            735835
            Hi,

            In your schema you probably want to add form="qualified" to <xs:element name="ReturnResult" type="xs:string"/> to prevent it ending up with no namespace (it's difficult to add xmlns="" via peoplecode).

            &Country = "Spain";

            &soapRes = CreateSOAPDoc();
            &soapRes.AddEnvelope(0);
            &soapRes.AddBody();
            &soapRes.BodyNode.AddElementNS("http://mdcourts.backoffice.jaxb", "PaymentTransactionsResponseMessage").AddElement("ResponseMessage").AddElement("ReturnResult").AddText(&Country);

            &response.SetXmlDoc(&soapRes.XmlDoc);
            Return &response


            Regards,

            Bauke