Using the HTTP Target Connector
This section provides examples of using the HTTP target connector and discusses how use the connector to:
-
Send standard HTTP requests.
-
Send SOAP messages in HTTP requests.
Sending Standard HTTP Requests
To send a standard HTTP request:
-
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field.
&msg = CreateMessage(Operation.EXAMPLE_SERVICE_OPR); &xmldata = "<?xml version='1.0'?><ConnectorTest/>"; /* create an XmlDoc */ &xmlDoc = CreateXmlDoc(&xmldata); &rootNode = &xmlDoc.documentelement; &descNode = &rootNode.addelement("HTTPtest"); &descNode.nodevalue = "This will be sent to an HTTP server."; /* put the XML in the message */ &msg.setxmldoc(&xmlDoc); /* send the request */ &response = %IntBroker.SyncRequest(&msg); /* and echo it back to the user */ &xmlDoc = &response.getxmldoc(); MessageBox(0, "", 0, 0, &xmlDoc.genxmlstring());Note that this code assumes that the response from the server is properly formatted XML.
-
In the PeopleSoft Pure Internet Architecture, open the node definition for TARGETNODE. Set the Connector ID to HTTPTARGET. Set the URL property value to the address of the HTTP server that will process the request.
-
Open the EXAMPLE_PAGE page, and click on the Test button. The HTTP response will be displayed in the resulting message box.
Sending SOAP Messages in HTTP Requests
To send a SOAP message in an HTTP request:
-
In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field.
&msg = CreateMessage(Operation.EXAMPLE_SERVICE_OPR); /* create a SOAP document */ &soapReq = CreateSOAPDoc(); &soapReq.AddMethod("TestNode", 1); &soapReq.AddParm("Text", "This is a SOAP request."); /* put the XML in the message */ &msg.setxmldoc(&soapReq.xmlDoc); /* send the request */ &response = %IntBroker.SyncRequest(&msg); /* and echo it back to the user */ &xmlDoc = &response.getxmldoc(); MessageBox(0, "", 0, 0, &xmlDoc.genxmlstring()); -
In the PeopleSoft Pure Internet Architecture, open the node definition for TARGETNODE.
-
On the Node Definitions-Connectors tab, set the Connector ID to HTTPTARGET.
-
Set the URL property value to the address of the HTTP server that will process the request.
-
-
Open the EXAMPLE_PAGE page, and click on the Test button. The HTTP response will be displayed in the resulting message box.