Showing posts with label Third party webservice. Show all posts
Showing posts with label Third party webservice. Show all posts

Webservices fail with "SAXException occured while parsing the SOAP Document" after PT upgrade 8.52

Canon Pixma MX432 Wireless Multifunction Printer - Wireless Printers (Google Affiliate Ad)
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
PeopleTools 8.52
HCM 9.1
FMS 9.1

Issue:
Created a new webservice and published from PeopleSoft on 8.51. Tested successfully using SOAPUI and worked fine.
Then tools were upgraded to 8.52 and the same service started failing with the above mentioned exception.

Try this solution:

1. Go to the Gateway Administration Page and then to the Advanced Options.
2. Change the ig.dtdLookup value from 'false' to 'true'. Save the changes.
3. Bounce the Web Server.

Sample WebService

This is a sample webservice created in PS finance database where the input request message would pass contract number and contract line number and the response message would return the opportunity id and the primary sales representative for that opportunity.

Step 1
create an application package and app class definition with method onRequest (this is used for synchronous operations. Peoplebooks have good documentation on this)


/*****************************************************************/
import PS_PT:Integration:IRequestHandler;


class X_REQ implements PS_PT:Integration:IRequestHandler
method onRequest(&MSG As Message) Returns Message;
method onError(&MSG As Message) Returns string;
end-class;

method onRequest

/+ &MSG as Message +/
/+ Returns Message +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/
Local Message &response;
Local XmlNode &PortalNode;
Local XmlNode &NameNode, &IdNode;



Local XmlDoc &RequestxmlDoc;
Local array of string &LangCd;
Local array of XmlNode &InputName;
Local string &LngCd;
&RequestxmlDoc = &MSG.GetXmlDoc();
&InputName = &RequestxmlDoc.GetElementsByTagName("InputName");
If &InputName.Len > 0 Then
&LngCd = &InputName [1].NodeValue
Else
&LngCd = "Anonymous";
End-If;

Local XmlDoc &xml;
&xml = CreateXmlDoc("");

&PortalNode = &xml.DocumentElement.AddElement("Portal");
&NameNode = &PortalNode.AddElement("Hello").AddText("Hello "
&LngCd);
&response = CreateMessage(Operation.X_REQ_INBOUND, %IntBroker_Response);
&response.SetXmlDoc(&xml);
Return &response;
end-method;

method onError

/+ &MSG as Message +/
/+ Returns String +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnError +/
Local integer &nMsgNumber, &nMsgSetNumber;
Local string &str;
&nMsgNumber = &MSG.IBException.MessageNumber;
&nMsgSetNumber = &MSG.IBException.MessageSetNumber;
&str = &MSG.IBException.DefaultText;
Return &str;
end-method;
/*****************************************************************/

Step 2:
Create request and response messages and add the schema
Messages are 'Non-rowset based'
===========================================================
Request message schema - Messsage name - X_REQ


 
<?xml version="1.0"?>
<xsd:schema targetNamespace="http://xmlns.TestWS.com/TestWSDir/Enterprise/Tools/schemas/X_REQ.VERSION_1" xmlns="http://xmlns.TestWS.com/TestWSDir/Enterprise/Tools/schemas/X_REQ.VERSION_1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="X_REQ_Request" type="X_REQ_Request_Type"/>
  <xsd:complexType name="X_REQ_Request_Type">
    <xsd:sequence>
      <xsd:element id="InputName" name="InputName" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>
 ===========================================================

Response message schema - Messsage name - X_RES

<?xml version="1.0"?>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://xmlns.TestWS.com/TestWSDir/Enterprise/Tools/schemas/X_RES.VERSION_1" xmlns:tns="http://xmlns.TestWS.com/TestWSDir/Enterprise/Tools/schemas/X_RES.VERSION_1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="X_RES" type="tns:ComponentResponseType"/>
  <xsd:complexType name="ComponentResponseType">
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" name="Portal" type="tns:ComponentType"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="ComponentType">
    <xsd:sequence>
      <xsd:element name="Hello" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>




============================================================

Step 3:
Create synchronous service operation and a service.
Make sure, you have enabled Any-to-Local routing and given access to the user mentioned on 'ANONYMOUS' node.

Step 4:
Publish the service using 'Provide Web Service' wizard under PeopleTools.

Step 5: testing using SoapUI
I use soapUI client for testing the SOAP request message and also parsing the wsdl file generated in step 4