29 Replies Latest reply on Apr 18, 2008 4:48 AM by johnqdaily

    using webservices in Workbench?

    AlvinPearson1
      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
        • 1. Re: using webservices in Workbench?
          Jasmin Charbonneau Level 4
          Can you be a bit more specific? In the WebService service, you can specify the wsdl you want to call and other parameters and specify a variable for the result of the call. Are you getting an error?

          If you call a LiveCycle service through web service the default WSDL is http://localhost:8080/soap/services/NameOfService?wsdl.

          Jasmin
          • 2. Re: using webservices in Workbench?
            AlvinPearson1 Level 1
            &#53256;l:definitions targetNamespace="http://www.egis-software.co.za/"><br />&#8722;<br />     <wsdl:types><br />&#8722;<br />     <s:schema elementFormDefault="qualified" targetNamespace="http://www.egis-software.co.za/"><br />&#8722;<br />     <s:element name="genAlloacteXml"><br />&#8722;<br />     <s:complexType><br />&#8722;<br />     <s:sequence><br /><s:element minOccurs="0" maxOccurs="1" name="inXml" type="s:string"/><br /></s:sequence><br /></s:complexType><br /></s:element><br />&#8722;<br />     <s:element name="genAlloacteXmlResponse"><br />&#8722;<br />     <s:complexType><br />&#8722;<br />     <s:sequence><br /><s:element minOccurs="0" maxOccurs="1" name="genAlloacteXmlResult" type="s:string"/><br /></s:sequence><br /></s:complexType><br /></s:element><br /></s:schema><br /></wsdl:types><br />&#8722;<br />     <wsdl:message name="genAlloacteXmlSoapIn"><br /><wsdl:part name="parameters" element="tns:genAlloacteXml"/><br /></wsdl:message><br />&#8722;<br />     <wsdl:message name="genAlloacteXmlSoapOut"><br /><wsdl:part name="parameters" element="tns:genAlloacteXmlResponse"/><br /></wsdl:message><br />&#8722;<br />     <wsdl:portType name="ServiceSoap"><br />&#8722;<br />     <wsdl:operation name="genAlloacteXml"><br /><wsdl:input message="tns:genAlloacteXmlSoapIn"/><br /><wsdl:output message="tns:genAlloacteXmlSoapOut"/><br /></wsdl:operation><br /></wsdl:portType><br />&#8722;<br />     <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap"><br /><soap:binding transport="http://schemas.xmlsoap.org/soap/http"/><br />&#8722;<br />     <wsdl:operation name="genAlloacteXml"><br /><soap:operation soapAction="http://www.egis-software.co.za/genAlloacteXml" style="document"/><br />&#8722;<br />     <wsdl:input><br /><soap:body use="literal"/><br /></wsdl:input><br />&#8722;<br />     <wsdl:output><br /><soap:body use="literal"/><br /></wsdl:output><br /></wsdl:operation><br /></wsdl:binding><br />&#8722;<br />     <wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap"><br /><soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/><br />&#8722;<br />     <wsdl:operation name="genAlloacteXml"><br /><soap12:operation soapAction="http://www.egis-software.co.za/genAlloacteXml" style="document"/><br />&#8722;<br />     <wsdl:input><br /><soap12:body use="literal"/><br /></wsdl:input><br />&#8722;<br />     <wsdl:output><br /><soap12:body use="literal"/><br /></wsdl:output><br /></wsdl:operation><br /></wsdl:binding><br />&#8722;<br />     <wsdl:service name="Service"><br />&#8722;<br />     <wsdl:port name="ServiceSoap" binding="tns:ServiceSoap"><br /><soap:address location="http://localhost/Allocate/Service.asmx"/><br /></wsdl:port><br />&#8722;<br />     <wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12"><br /><soap12:address location="http://localhost/Allocate/Service.asmx"/><br /></wsdl:port><br /></wsdl:service><br /></wsdl:definition     '<br /><br />Here is the wsdl file can u give me an example of how to setup the "webservice component"
            • 3. Re: using webservices in Workbench?
              Jasmin Charbonneau Level 4
              Have you tried to just put the web service url under the WSDL URL parameter of the Settings tab and hit load.

              Do you get a list of method to invoke under Operations?

              Jasmin
              • 4. Re: using webservices in Workbench?
                AlvinPearson1 Level 1
                Yes i get the correct Operation but i think the problem is under request tab
                • 5. Re: using webservices in Workbench?
                  Jasmin Charbonneau Level 4
                  Click "Generate". It will create the default structure of the SOAP request.

                  You can replace parts of it with an xPath expression. In my case, my WebService returns the following:


                    
                    
                       
                           ?
                           ?
                       

                    



                  Then you can replace the ? with xPath expressions:


                    
                    
                       
                           {$ /process_data/@param1 $}
                           {$ /process_data/@param2 $}
                       

                    



                  You can also put test data instead of the xPath in the test section so you can use the Test tab.

                  Then go under Test and test the call.

                  This should give you a soap response like the following:


                    
                       
                           4
                       

                    



                  Then I used a SetValue to get to the value from my soap response message (outResult which is an XML variable) into a string:

                  /process_data/outResult/soapenv:Envelope/soapenv:Body/tmp:invokeResponse/tmp:outValue

                  Now you need to be careful with the namespace in the xPath. In order to be able to use xPath on an xml that contain namespaces, you need to add them in the process properties.

                  Right click on you process (from the Processes tab) and select properties. The under Advanced add the following namespaces:

                  soapenv http://schemas.xmlsoap.org/soap/envelope/
                  tmp http://adobe.com/idp/services

                  It will be a bit different if you get XML back, but that should get you started.

                  Let me know how that works.

                  Jasmin
                  • 6. Re: using webservices in Workbench?
                    AlvinPearson1 Level 1
                    looks closer than what i was <br />this what it returns<br /><?xml version="1.0" encoding="UTF-8"?><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:Body><br />      <genAlloacteXmlResponse xmlns="http://www.egis-software.co.za/"><br />         <genAlloacteXmlResult>Data at the root level is invalid. Line 1, position 1.</genAlloacteXmlResult><br />      </genAlloacteXmlResponse><br />   </soap:Body><br /></soap:Envelope><br />does it mean there is some thing wrong with my webservice
                    • 7. Re: using webservices in Workbench?
                      AlvinPearson1 Level 1
                      How do i get only my XML out not the complete response?
                      • 8. Re: using webservices in Workbench?
                        AlvinPearson1 Level 1
                        Jasmin<br /><br />In the browser when i test my webservice i send:<br /><?xml version="1.0" encoding="UTF-8"?><Body><FlowMain><FlowItem><FixedItem><itemId>140</itemId><ItemName>Book 2 </ItemName><ItemDescription>Item2 Of Pack2 </ItemDescription><PackId>74</PackId><ItemQty>100</ItemQty><ItemPrice>0 </ItemPrice><finishing>2 </finishing><trimSize>1 </trimSize></FixedItem><FlowPart><FixedPart><PartId>154</PartId><PartName>Unbound-Certifi cates </PartName><PartDescription>Pages </PartDescription><ItemId>140</ItemId><PartQty>110</PartQty><PartDiscount>0</PartDiscount ><hasClick>false</hasClick></FixedPart><FlowComp><FixedComp><componentId>180</componentId> <PartId>154</PartId><componentCost>1.4000</componentCost><selectedComponent>BOARD A4 GRECIAN NAVY </selectedComponent><Nup>1</Nup><ComponentQty>1</ComponentQty><profile>1</profile><number OfImages>1</numberOfImages><action>0</action><selectedComponentId/></FixedComp></FlowComp> </FlowPart></FlowItem><FlowItem><FixedItem><itemId>141</itemId><ItemName>Book3 </ItemName><ItemDescription>Book3 </ItemDescription><PackId>74</PackId><ItemQty>3</ItemQty><ItemPrice>3 </ItemPrice><finishing>3 </finishing><trimSize>3 </trimSize></FixedItem><FlowPart><FixedPart><PartId>155</PartId><PartName>Data cleaning </PartName><PartDescription>2 </PartDescription><ItemId>141</ItemId><PartQty>2</PartQty><PartDiscount>0</PartDiscount>< hasClick>false</hasClick></FixedPart><FlowComp><FixedComp><componentId>181</componentId><P artId>155</PartId><componentCost>0.7200</componentCost><selectedComponent>HANNO GLOSS 300G </selectedComponent><Nup>2</Nup><ComponentQty>1</ComponentQty><profile>1</profile><number OfImages>2</numberOfImages><action>0</action><selectedComponentId/></FixedComp></FlowComp> </FlowPart></FlowItem><FlowItem><FixedItem><itemId>139</itemId><ItemName>MyBook1 </ItemName><ItemDescription>Book1 </ItemDescription><PackId>74</PackId><ItemQty>1</ItemQty><ItemPrice>1 </ItemPrice><finishing>1 </finishing><trimSize>1 </trimSize></FixedItem><FlowPart><FixedPart><PartId>153</PartId><PartName>Bound perfect </PartName><PartDescription>2 </PartDescription><ItemId>139</ItemId><PartQty>2</PartQty><PartDiscount>0</PartDiscount>< hasClick>false</hasClick></FixedPart><FlowComp><FixedComp><componentId>179</componentId><P artId>153</PartId><componentCost>0.1000</componentCost><selectedComponent>A3 BOND DBN </selectedComponent><Nup>2</Nup><ComponentQty>1</ComponentQty><profile>1</profile><number OfImages>2</numberOfImages><action>0</action><selectedComponentId/></FixedComp></FlowComp> </FlowPart></FlowItem></FlowMain></Body><br /><br />it returns a string containing :<br /><?xml version="1.0" encoding="UTF-8"?><form1><page><list><flow><fixed><Id>140</Id><Name>Book2 </Name><Branch></Branch></fixed><fixed><Id>141</Id><Name>Book3 </Name><Branch></Branch></fixed><fixed><Id>139</Id><Name>MyBook1 </Name><Branch></Branch></fixed></flow></list></page></form1><br /><br />any special tags i am gone need to integrate it with a pdf?<br />(it is same structure as pdf)
                        • 9. Re: using webservices in Workbench?
                          Jasmin Charbonneau Level 4
                          No. If you use renderPDFForm, then you can use any xml to merge with it.

                          If you use importData (from the FormDataIntegration service), then you'll need to add the xfa header tags.

                          You'll always get whole soap response in your XML variable. You'll need to use a SetValue to extract the content you want from it.

                          Jasmin
                          • 10. Re: using webservices in Workbench?
                            AlvinPearson1 Level 1
                            thanks for your help jasmin
                            • 11. Re: using webservices in Workbench?
                              AlvinPearson1 Level 1
                              Hi Jasmin

                              My webservice is expecting a string containing xml code.
                              But as far as i can see its not receiving any xml only the data between the xml tags which makes it useless. If i make the xml a string using the setValue component it does not put a value in my return object.

                              Thanks
                              Alvin
                              • 12. Re: using webservices in Workbench?
                                AlvinPearson1 Level 1
                                I have made my web service to return example XML if u send empty string<br />to it. So i can go on with the process.<br />now to get the data out i use setValue as you said i sould:<br />"/process_data/xml/soapenv:Envelope/soapenv:Body/tmp:genAlloacteXmlResponse/tmp:genAllo acteXmlResult"<br /><br />and that gives me the following:<br /><?xml version="1.0" encoding="UTF-8"?><br /><genAlloacteXmlResult xmlns="http://www.egis-software.co.za/"><?xml version="1.0" encoding="UTF-8"?><form1><page><list><flow><fixed><Id>140</Id><Name>Book2 </Name><Branch></Branch></fixed><fixed><Id>141</Id><Name>Book3 </Name><Branch></Branch></fixed><fixed><Id>139</Id><Name>MyBook1 </Name><Branch></Branch></fixed></flow></list></page></form1></genAlloacteXmlResult><br /><br />how do i get the CDATA now?
                                • 13. Re: using webservices in Workbench?
                                  Jasmin Charbonneau Level 4
                                  Your namespace is different than mine. Is your tmp prefix pointing to http://www.egis-software.co.za/ instead of http://adobe.com/idp/services like in my case?

                                  Also, when you send XML, you might have to wrap it in CDATA tags to avoid the XML being confused with the XML of the soap message.

                                  Jasmin
                                  • 14. Re: using webservices in Workbench?
                                    AlvinPearson1 Level 1
                                    Hi

                                    I have changed the namespace in the property's.
                                    How do remove or add the CDATA tags?

                                    thanks
                                    • 15. Re: using webservices in Workbench?
                                      Jasmin Charbonneau Level 4
                                      I can't post an example because the forums engine doesn't post it. The forum's engine is probably xml based and gets confused with the CDATA.

                                      Go to that site to see an example:
                                      http://www.w3schools.com/xml/xml_cdata.asp

                                      Just use the SetValue to add the tags to your xml string.

                                      Jasmin
                                      • 16. Re: using webservices in Workbench?
                                        AlvinPearson1 Level 1
                                        thanks for your help i made my own component that does the same work as the web service works better (don't have to worry about CDATA)
                                        • 17. Re: using webservices in Workbench?
                                          Gary Gilchrist Level 1
                                          Also, Don't forget to check the "Optional" inputs when loading the WSDL from the property editor in Workbench so that you will get all the operations and parameters.
                                          • 18. Re: using webservices in Workbench?
                                            johnqdaily Level 1
                                            Alvin,

                                            I am having similar issues. What type of component did you build to replace web services?

                                            Thanks,

                                            John
                                            • 19. Re: using webservices in Workbench?
                                              AlvinPearson1 Level 1
                                              Hi

                                              I made my web service a Java component that returns a string containing my XML for the form.
                                              • 20. Re: using webservices in Workbench?
                                                johnqdaily Level 1
                                                @Jasmin,

                                                I followed your steps and I am getting the data I need in the xml variable but I still am not able to get the data out using Set Value. I checked out the CDATA but was not able to get that to work (the W3C website was not very useful).

                                                Do you have any other thoughts on how I might be able to extract the data from the variable? I think I have explored just about every option but seem to have run into a road block.

                                                Thanks,

                                                John
                                                • 21. Re: using webservices in Workbench?
                                                  Jasmin Charbonneau Level 4
                                                  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
                                                  • 22. Re: using webservices in Workbench?
                                                    johnqdaily Level 1
                                                    @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
                                                    • 23. Re: using webservices in Workbench?
                                                      Jasmin Charbonneau Level 4
                                                      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:GetEm ployeeByNetworkIdResult/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
                                                      • 24. Re: using webservices in Workbench?
                                                        johnqdaily Level 1
                                                        @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:GetE mployeeByNetworkIdResult/temp:EmployeeInfo/temp:NetworkId"

                                                        Thanks again!

                                                        John
                                                        • 26. Re: using webservices in Workbench?
                                                          johnqdaily Level 1
                                                          @Jasmin,

                                                          It worked great!

                                                          Thank you!

                                                          John
                                                          • 27. Re: using webservices in Workbench?
                                                            johnqdaily Level 1
                                                            @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
                                                            • 28. Re: using webservices in Workbench?
                                                              Level 1
                                                              Hi
                                                              so are you looking to pass a value into the web service call?
                                                              • 29. Re: using webservices in Workbench?
                                                                johnqdaily Level 1
                                                                @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