Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

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
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

Avatar

Former Community Member
&#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"

Avatar

Level 10
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

Avatar

Former Community Member
Yes i get the correct Operation but i think the problem is under request tab

Avatar

Level 10
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

Avatar

Former Community Member
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

Avatar

Former Community Member
How do i get only my XML out not the complete response?

Avatar

Former Community Member
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>Book2 </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-Certificates </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><numberOfImages>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><PartId>155</PartId><componentCost>0.7200</componentCost><selectedComponent>HANNO GLOSS 300G </selectedComponent><Nup>2</Nup><ComponentQty>1</ComponentQty><profile>1</profile><numberOfImages>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><PartId>153</PartId><componentCost>0.1000</componentCost><selectedComponent>A3 BOND DBN </selectedComponent><Nup>2</Nup><ComponentQty>1</ComponentQty><profile>1</profile><numberOfImages>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)

Avatar

Level 10
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

Avatar

Former Community Member
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

Avatar

Former Community Member
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:genAlloacteXmlResult"<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?

Avatar

Level 10
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

Avatar

Former Community Member
Hi



I have changed the namespace in the property's.

How do remove or add the CDATA tags?



thanks

Avatar

Level 10
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

Avatar

Former Community Member
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)

Avatar

Level 3
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.

Avatar

Former Community Member
Alvin,



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



Thanks,



John

Avatar

Former Community Member
Hi



I made my web service a Java component that returns a string containing my XML for the form.

Avatar

Former Community Member
@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