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>
<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>
<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
It helped.
ReplyDeleteAfter spending weeks of trial and errors struggling, desperation led me to this article and YESSS, that thing is up and running now, FINALLY! Thanks a bunch, mate.
ReplyDelete