Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

using webservices in Workbench?

Avatar

Former Community Member
HI



How do one use the web service Service in workbench

setup the soap and getting response out?



Any help would be appreciated



thanks



PS. i have a web service that returns an XML that needs to be integrated into a pdf
29 Replies

Avatar

Level 10
What's the format of your XML?



Use a variable logger and write it to a file to see what's the structure and post it in here.



I'll try to help you get the data you need with the appropriate xPath.



Jasmin

Avatar

Former Community Member
@Jasmin,<br /><br />Thank you for your help in this. Below is the xml from my log file.<br /><br />Begin Code ----------------------------------------<br /><br /><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><br /> <soap:Header><br /> <ServiceSecurityHeader xmlns="http://kingpharm.com/AppServices/Personnel"><br /> <ClientAuthenticationData>aBcDeF123456</ClientAuthenticationData><br /> </ServiceSecurityHeader><br /> </soap:Header><br /> <soap:Body><br /> <GetEmployeeByNetworkIdResponse xmlns="http://kingpharm.com/AppServices/Personnel"><br /> <GetEmployeeByNetworkIdResult><br /> <EmployeeInfo><br /> <FirstName></FirstName><br /> <LastName></LastName><br /> <MiddleName></MiddleName><br /> <PreferredName></PreferredName><br /> <NameSuffix/><br /> <FullName></FullName><br /> <ContactInformation><br /> <Company></Company><br /> <WorkEmailAddress></WorkEmailAddress><br /> <PhoneNumbers><br /> <NanpPhoneNumber><br /> <IsWorkPhone></IsWorkPhone><br /> <PhoneType></PhoneType><br /> <CountryCode></CountryCode><br /> <AreaCode></AreaCode><br /> <ExchangeCode></ExchangeCode><br /> <StationCode></StationCode><br /> <Extension></Extension><br /> </NanpPhoneNumber><br /> <NanpPhoneNumber><br /> <IsWorkPhone></IsWorkPhone><br /> <PhoneType></PhoneType><br /> <CountryCode></CountryCode><br /> <AreaCode></AreaCode><br /> <ExchangeCode></ExchangeCode><br /> <StationCode></StationCode><br /> <Extension></Extension><br /> </NanpPhoneNumber><br /> </PhoneNumbers><br /> </ContactInformation><br /> <NetworkId>ABcdefg</NetworkId><br /> <EmployeeNumber>12345</EmployeeNumber><br /> <JobPosition><br /> <JobCode></JobCode><br /> <JobTitle></JobTitle><br /> <SupervisoryLevel><br /> <Level></Level><br /> <Description></Description><br /> </SupervisoryLevel><br /> <Department><br /> <DepartmentCode></DepartmentCode><br /> <Name></Name><br /> <ShortName></ShortName><br /> <FunctionalArea><br /> <FunctionalAreaCode></FunctionalAreaCode><br /> <Name></Name><br /> </FunctionalArea><br /> <Location><br /> <LocationCode></LocationCode><br /> <Name></Name><br /> <ShortName></ShortName><br /> </Location><br /> </Department><br /> <PositionStartDate></PositionStartDate><br /> <OrganizationEmployeeCount></OrganizationEmployeeCount><br /> <WorkLocation><br /> <LocationCode></LocationCode><br /> <Name></Name><br /> <ShortName></ShortName><br /> </WorkLocation><br /><br />End Code ----------------------------------<br /><br />I am trying to extract NetworkId and EmployeeNumber from the XML above (approximately center of the XML). The data writes to the variable fine but I just can't get it out. Also, should I have have the XML schema listed in the variable?<br />I have this web service in my main process and have named all of the namespaces in the process properties. After the web service I have a Set Value that I am trying to write the field I need to a string variable.<br /><br />Thanks again!<br /><br />John

Avatar

Level 10
You don't absolutely need the xml schema listed in the variable. If you do have it, it'll simplify the creation of you xPath statement since you'll be able to browse down the structure of your xml instead or trying to figure it out.



I think the xPath you'll need to use is something like:

/process_data/myXML/soap:Envelope/soap:Body/temp:GetEmployeeByNetworkIdResponse/temp:GetEmployeeByNetworkIdResult/temp:EmployeeInfo/temp:NetworkId



You'll need to add the two namespaces under the properties of you process for the expression to work.



Right click on your process from the Processes view and select Properties, then Advanced. Under Registered Prefixes for Namespaces make sure to add the following:



soap -> http://schemas.xmlsoap.org/soap/envelope/

temp -> http://kingpharm.com/AppServices/Personnel



You can replace temp with any id you want (just make sure to update your xPath expression). All children node of GetEmployeeByNetworkIdResponse inherits that namespace by default.



I hope this helps.



Jasmin

Avatar

Former Community Member
@Jasmin,



Thank you for this.



Just to clarify:



I will use the following as the expression in my Set Value and the Location will be my emplID string variable?

"/process_data/myXML/soap:Envelope/soap:Body/temp:GetEmployeeByNetworkIdResponse/temp:GetEmployeeByNetworkIdResult/temp:EmployeeInfo/temp:NetworkId"



Thanks again!



John

Avatar

Former Community Member
@Jasmin,



I have one more question.



If I wanted to create a component out of this web service can it be done?



I need to pull 1 data field off of the report (I have a custom renderPDFForm process that populates some user data when the user clicks on the form in Workspace). Then I need to pass that into a variable to put into the Web Service.



I was looking at using 'Get Value of Form Field' under Form Augmenter to get the data from the field on the form. Is this the right track or do I need to look at doing something else?



Thanks,



John

Avatar

Former Community Member
Hi

so are you looking to pass a value into the web service call?

Avatar

Former Community Member
@WorkflowUser,



Yes. Here is how my current process works.



I have a custom renderPDFForm render component that gets the user name and networkID from the LCES database. Then it puts those into two fields on the form and renders it when the user opens the form up in Workspace. What I want to do is create a web service component that I can pass the user's networkID from the report into the Invoke on the custom web service component and that will return a string.

I tried it and the problem I was having was passing networkID from the form into the Invoke on the web service component and then passing that back into the forms main process.

Note: there will be a total of 3 of these web service components in this form due to automatic routing based on the user's managers.

I have the web services all in the main form process and the work like they should but I would like to make them as components so that we can use them in other forms.



Thanks,



John