2

I am trying to consume the following web service from ColdFusion:

http://xserv.dell.com/services/assetservice.asmx

I should be able to consume the web service using the code below:

<cfscript> 
    params = structNew(); 
    params.guid = "11111111-1111-1111-1111-111111111111"; 
    params.applicationName = "test"; 
    params.serviceTags = "JLJMHX1"; 

    ws = createObject("webservice", "http://xserv.dell.com/services/assetservice.asmx?wsdl"); 

    writeDump(ws)

    ws.GetAssetInformation(params); 
</cfscript> 

The results of dumping out the WSDL information (ws), indicates that the GetAssetInformation method has the following signature:

getAssetInformation(com.microsoft.wsdl.types.Guid, java.lang.String, java.lang.String)

The service call errors every single time, saying that:

"Error Occurred While Processing Request Web service operation GetAssetInformation with parameters {11111111-1111-1111-1111-111111111111,test,JLJMHX1} cannot be found."

I am sure this is due to the method expecting a "com.microsoft.wsdl.types.Guid" data type, but how can I pass that in via ColdFusion?

I can create and run the request in Fiddler with the same data and get a response back without issue, so there is something I am doing wrong in ColdFusion.

Any help would be appreciated.

Josh Taylor
  • 532
  • 2
  • 8
  • 1
    Check out answer on this (http://stackoverflow.com/questions/18924162/can-someone-tell-me-if-colfusion-8-can-consume-a-wcf-service/18933851#18933851) question and try to invoke soap using cfhttp. – nkostic Jan 31 '14 at 03:56
  • I have seen this method, but I was unable to get it working. I will try again sometime today and post my results. – Josh Taylor Jan 31 '14 at 19:14
  • I found the answer here using the method described by Nesha8x8 (http://stackoverflow.com/questions/17967266/consume-soap-web-service-having-complex-types?rq=1) – Josh Taylor Jan 31 '14 at 23:46

2 Answers2

3

The method expects a guid and two strings. You are passing a structure. Pass the arguments separately.

ColdFusion 10 also introduces Axis 2 for web services by default. For some web services, you need to use Axis 1 which you can enable in the ColdFusion Administrator. You will also need to refresh the web service.

createObject("webservice", theURL, {refreshWSDL=true,wsVersion=1})

Sean Coyne
  • 3,864
  • 21
  • 24
  • 1
    (Edit) ... or use "argumentCollection" to pass them separately `ws.GetAssetInformation( argumentCollection=params );` – Leigh Jan 31 '14 at 13:58
  • I think that will only work with named arguments Leigh. His method signature does not show named arguments. – Sean Coyne Jan 31 '14 at 14:39
  • 1
    Sean - cfdump never shows argument names for java methods, only types. I assume he is looking at the wsdl ie http://xserv.dell.com/services/assetservice.asmx?op=GetAssetInformation – Leigh Jan 31 '14 at 14:42
  • It will :) but you pointed out the real problem: passing the wrong arguments. – Leigh Jan 31 '14 at 14:58
  • I have tried invoking it using "ws.getAssetInformation(argumentCollection=params);" and also passing the parameters in separately like this "ws.getAssetInformation(params.guid, params.applicationName, params.serviceTags);" but I am still getting the same result, web service operation cannot be found... – Josh Taylor Jan 31 '14 at 17:49
  • I am curious as to why this method wasn't working for me, but I was finally able to get it to work using CFHTTP and calling the service manually. Thank you for your answers, and if you have any additional insight into the issue I would love to hear it. – Josh Taylor Jan 31 '14 at 23:47
  • 1
    @Josh - Curious. Your original code worked fine with argumentCollection (tested with CF9). (Edit) The only thing I can think of is Axis version maybe? (CF10 introduced Axis2 support). Try [setting it to version 1](http://www.adobe.com/devnet/coldfusion/articles/axis2-web-services.html). Any difference? – Leigh Feb 01 '14 at 04:30
  • 1
    Yes, I can confirm the issue is the Axis change in CF10. Using separate parameters or argumentCollection works when the version is set to Axis1. Note, you must refresh the web service for the changes to take effect ie `createObject("webservice", theURL, {refreshWSDL=true,wsVersion=1})`. – Leigh Feb 02 '14 at 05:47
  • I appreciate all the help Leigh, I am using CF10 which would explain why it isn't working. Hopefully tomorrow I will have time to test your solution. I would prefer use createObject to handle requests to the web service rather than invoking the service manually via CFHTTP. I will mark this as the answer as soon as I test it out. Thanks again! – Josh Taylor Feb 04 '14 at 00:48
  • Sounds good. I re-tested with CF10, so I am confident it should do the trick. @Sean - If it all works out, can you incorporate that into your response? (Might as well have both parts of the answer in once place :) – Leigh Feb 04 '14 at 13:05
0

I found the answer by following the instructions in this post:

Consume SOAP web service having complex types

Thanks for the help everyone!

Community
  • 1
  • 1
Josh Taylor
  • 532
  • 2
  • 8