ERP Associates, Inc.

Solutions for People and their Software

Welcome, Guest
Please Login or Register.    Lost Password?
Go to bottomPage: 12
TOPIC: Providing A Webservice example
4 Years ago #25
Providing A Webservice example _GEN_PRINT
Hello,
I am trying to understand how to create a webservice.

I want to provide a webservice where in an external system will submit a request ( say passing the location id and the service will query the name and sent the response back.

While CI based Webservice is probably the easiest way to go, I want to create a non CI based service ( a non rowset based message ( request and response add an xml schema to both ) and then invoke it thru send master.

I do see situations were it does makes sense from performance angle to do a simple webservice. And I am currently stumbling at it.

Has anyone worked on this ? Or is there a document on this ?
User Offline
The administrator has disabled public write access. _GOTOTOP
hee4haw
 
Fresh Boarder
Posts: 11
graphgraph
4 Years ago #28
Re:Providing A Webservice example _GEN_PRINT
I have done this so far:


1. Created a request and a response message.

Both are containers with a underlying rowset based message part(rowset based ) .

In the request message the record is PERSONAL_DATA and the only field exposed in EMPLID in the request message and additional fields of LAST_NAME and FIRST_NAME in the response message.

2. Created a service and service operation ( sync ) with an any to local routing and added the Serv op. to Permission list that I(my userid ) have access to. ( The default userid on the local node is something else.)

3. I have exposed the Service Operation as a web service. The end result is a creation of a WSDL document.

When I request for generation of the SOAP template, I am not seeing the body created . I see an empty body. No tags for PERSONAL_DATA, EMPLID, LAST_NAME and FIRST_NAME.


Here is the request message template: ( ( not sure how to supress yje emotocons.. )

<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenc="schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="schemas.xmlsoap.org/ws/2003/03/addressing/" xmlns:xsd="www.w3.org/2001/XMLSchema/" xmlns:xsi="www.w3.org/2001/XMLSchema-instance/">
<soapenv:Header xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/">
<wsse:Security soap:mustUnderstand="1" xmlns:soap="schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="docs.oasis-open.org/wss/2004/01/oasis-20...xt-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>XXX </wsse:Username>
<wsse:Password>XXX</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/"/>
</soapenv:Envelope>


Notice how the body does not have the PERSONAL_DATA, EMPLID tags. My understanding was that the SOAP teplate could be used to create a message to place in the Sendmaster.

Not sure where I am going wrong.
User Offline
The administrator has disabled public write access. _GOTOTOP
hee4haw
 
Fresh Boarder
Posts: 11
graphgraph
4 Years ago #29
Re:Providing A Webservice example _GEN_PRINT
Actually if you want to do a real simple web service, you don't need integration broker, SOAP_TO_CI or any of that junk. You can actually create a simple PeopleCode program using the %Request and %Response objects (see PeopleCode API PeopleBook) and invoke it from a URL.

You'll just have to make your PCode parse the incoming XML, and build the outgoing XML. But that's pretty simple logic.

I've done a couple of posts that take advantage of WEBLIB's if you want to see how it's done:

www.erpassociates.com/peoplesoft-corner-...ries-from-excel.html

www.erpassociates.com/peoplesoft-corner-...tem-via-iscript.html

Hope that helps!

-Brent
User Offline
The administrator has disabled public write access. _GOTOTOP
brent
 
Moderator
Posts: 117
graph
4 Years ago #34
Re:Providing A Webservice example _GEN_PRINT
Brent,
Thanks for the links and point noted.
However, is it possible to explain how a simple webservice can be created and tested. I want to know the xml message that I should pass to the sendmaster. As the generate soap template does not seem to be creating a message with the fields that I need to populate.
User Offline
The administrator has disabled public write access. _GOTOTOP
hee4haw
 
Fresh Boarder
Posts: 11
graphgraph
4 Years ago #35
Re:Providing A Webservice example _GEN_PRINT
I have managed to get something done.

I am getting a response. But the response is truncated.

To genarate the response, I am doing the following:


1. Create a SOAP doc.
2. Add an envelope
3. add a body
4. Get the body xml node
5. add elements one by one per the SOAPTemplate response.
6. Create a response message for the Service Operation.
7. set the xmldoc of the responsemessage to the xmldoc extracted from the SOAPDoc.

Here is the issue:

The message returned is incomplete. Only the first element gets added. I am losing all the child element and the values set for those elements.

If I look at the SOAP document by placing the code on a button on a page, I see all the elements.


It appears that at step 7, I am losing the elements ( when I assign the xml doc to the message )

I am wondering whether my approach is correct. Or there is a better way to do it.

brent, what is SOAP to CI ? I did not find the need to use it. Or is it automatically used under the hood ?

Thanks.
User Offline
The administrator has disabled public write access. _GOTOTOP
hee4haw
 
Fresh Boarder
Posts: 11
graphgraph
4 Years ago #36
Re:Providing A Webservice example _GEN_PRINT
Just a clarification.

I do see the first element that I am adding. Also other element that I add as child elements are lost.

Also, I am using SendMaster to post the SOAP message. and getting a truncated respose from Peoplesoft.
User Offline
The administrator has disabled public write access. _GOTOTOP
hee4haw
 
Fresh Boarder
Posts: 11
graphgraph
Go to topPage: 12
Back to Top