Webservice integration

One Star

Webservice integration

Hi all,
I feel like I am doing something wrong with my integration of web services.
I want to pass data to the services parameters (inputs?) and send the results (outputs?) to another component. To start off with that can just be a tlogrow.
Even using a tWebServiceInput will be fine if I can figure out how to send the necessary and desired parameters and skip the optional ones that I don't want to use.
In SOAP UI my request looks something like this:
<soapenv:Body>
<nxt:ICGetProductList>
<nxt:connectString>AppServer://myserver:1234/someplace</nxt:connectString>
<nxt:userCode>Cono=1000|Oper=sys</nxt:userCode>
<nxtSmiley Tongueassword>sys</nxtSmiley Tongueassword>
<nxt:requestObject>
<nxt:includeInactiveProducts>1</nxt:includeInactiveProducts>
<nxt:recordLimit>0</nxt:recordLimit>
</nxt:requestObject>
</nxt:ICGetProductList>
</soapenv:Body>
And it works fine against the web service. (i.e. it gives me an array of products)
e.g.
.
.
.
<arrayProduct>
<ICGetProductList.output.Product>
<productCode>1-000</productCode>
<description1>Tools - Cutting & Mach</description1>
<description2/>
<productCategory>pc1</productCategory>
.
.
. more products...
</arrayProduct>
I think that this should be a fairly simple setup and it should be easy to implement but it isn't working. Does any one know of a good resource to learn about basic Talend webservice usage?
One Star

Re: Webservice integration

I tried a simpler example with a little better success. I hit a weather service WSDL (http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl) and used a tRowGenerator to feed it random zip codes. The responses are then going to a MySQL db.
The challenge I have is when I make a request and I get multiple results. So in this case, I pass a zip code and it gives back one record with the temperature etc for that city. In the scenario described above, I pass username and password and a few other parameters and it give me back an array of products. I want to take take that array and send it to another component. I think that the problem is with how my output schema is constructed.
Any suggestions?
One Star

Re: Webservice integration

Still looking for help on this topic.
I'm trying a different web service and I'm trying to do something that should be pretty simple. I am connecting to a PIM Core SOAP service and I am just trying to get a list of objects by class. (getObjectList method). It looks like the call is working but the output is giving me problems.
The output I see in SOAP UI is as follows:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://pimdev.optimumstores.com:8000/webservice/soap/endpoint/apikey/bab577b5ca12dc689a10a9a35e90d44b/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:getObjectListResponse>
<return SOAP-ENC:arrayType="ns1:Object_List_Item" xsi:type="ns1:ArrayOfObject_List_Item">
<item xsi:type="ns1:Object_List_Item">
<id xsi:type="xsd:int">37486</id>
<type xsi:type="xsd:string">object</type>
</item>
</return>
</ns1:getObjectListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

My Talend Job is pretty straight forward. A tFixedFlowInput going to then to my tWebService component which outputs to a tLogRow. I set the output schema as a document and synced the tLogRow to the schema of the web service. When I go to run it gives me this error:
Exception in component tWebService_1
java.lang.RuntimeException: Error compiling schema from WSDL at {file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl}:
undefined simple or complex type 'soap-enc:Array'
at line 4 column 208 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined attribute 'soap-enc:arrayType'
at line 4 column 247 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined simple or complex type 'soap-enc:Array'
at line 4 column 642 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined attribute 'soap-enc:arrayType'
at line 4 column 681 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined simple or complex type 'soap-enc:Array'
at line 4 column 3837 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined attribute 'soap-enc:arrayType'
at line 4 column 3876 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined simple or complex type 'soap-enc:Array'
at line 4 column 11408 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined attribute 'soap-enc:arrayType'
at line 4 column 11447 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined simple or complex type 'soap-enc:Array'
at line 4 column 16160 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined attribute 'soap-enc:arrayType'
at line 4 column 16199 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined simple or complex type 'soap-enc:Array'
at line 4 column 16596 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
undefined attribute 'soap-enc:arrayType'
at line 4 column 16635 of schema file:/C:/Users/ctaylor/AppData/Local/Temp/wsdl1354220577164/mainWSDL.wsdl
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory$InnerErrorListener.throwException(DynamicClientFactory.java:714)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:320)
at org.talend.webservice.helper.ServiceInvokerHelper.createClient(ServiceInvokerHelper.java:143)
at org.talend.webservice.helper.ServiceInvokerHelper.getClient(ServiceInvokerHelper.java:134)
at org.talend.webservice.helper.ServiceInvokerHelper.invoke(ServiceInvokerHelper.java:235)
at myproject.getproductlist_0_1.GetProductList.tFixedFlowInput_1Process(GetProductList.java:1248)
at myproject.getproductlist_0_1.GetProductList.runJobInTOS(GetProductList.java:1589)
at myproject.getproductlist_0_1.GetProductList.main(GetProductList.java:1442)
Caused by: org.xml.sax.SAXParseException: undefined simple or complex type 'soap-enc:Array'
at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:176)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:170)
at com.sun.xml.xsom.impl.parser.DelayedRef.resolve(DelayedRef.java:125)
at com.sun.xml.xsom.impl.parser.DelayedRef.run(DelayedRef.java:100)
at com.sun.xml.xsom.impl.parser.ParserContext.getResult(ParserContext.java:131)
at com.sun.xml.xsom.parser.XSOMParser.getResult(XSOMParser.java:226)
at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:519)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:236)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:52)
at $Proxy18.bind(Unknown Source)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:318)
... 6 more

This is about as simple as it gets I think. Any ideas how to get this working?