1

I have been a coldfusion developer since 1999 but the last few years I have been working more with other technologies. Recently I have been asked to implement a client for a webservice that allows one to order pharmacists medicines at a wholesale depot.

The full service description can be found here: http://services.bitler.be/GenericServices/OrderProcessingService.svc?singleWsdl

I think the relevant sections for consuming the client are the following ones, but feel free to look at the full description in case I missed anything:

  • The function: <wsdl:operation name="ProcessOrder">
  • The expected parameters:
<xs:complexType name="OrderProcessingRequest">
<xs:complexContent mixed="false">
<xs:extension .... base="q1:RequestBase">
<xs:sequence>
<xs:element minOccurs="0" name="CustomerEmail" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="ProcessOrderLines" nillable="true" type="tns:ArrayOfProcessOrderLine"/>
<xs:element ... minOccurs="0" name="Site" type="q2:FebelcoSite"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="OrderProcessingRequest" nillable="true" type="tns:OrderProcessingRequest"/>
<xs:complexType name="ArrayOfProcessOrderLine">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="ProcessOrderLine" nillable="true" type="tns:ProcessOrderLine"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfProcessOrderLine" nillable="true" type="tns:ArrayOfProcessOrderLine"/>
<xs:complexType name="ProcessOrderLine">
<xs:sequence>
<xs:element minOccurs="0" name="ProductNumber" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="QuantityRequested" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ProcessOrderLine" nillable="true" type="tns:ProcessOrderLine"/>

<xs:complexType name="RequestBase">
<xs:sequence>
<xs:element minOccurs="0" name="ApbNumber" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="BSKey" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="WholesalerId" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="RequestBase" nillable="true" type="tns:RequestBase"/>

This is what I have come up with so far:

cffunction name="placeOrder" access="remote" returntype="any">
    <cfargument name="apbnr" required="yes" type="string">
    <cfargument name="bskey" required="yes" type="string">
    <cfargument name="cnk" required="yes" type="string">
    <cfargument name="quantity" required="yes" type="string">
    <cfargument name="site" required="yes" type="string">
    <cfscript>
        orderProcessingRequest = StructNew();
        orderProcessingRequest.apb = apbnr;
        orderProcessingRequest.bskey = bskey;
        orderProcessingRequest.vestiging = site;
        productOrderLines = ArrayNew(1);
        productOrderLine = StructNew();
        productOrderLine.cnk = cnk;
        productOrderLine.quantity = quantity;
        productOrderLines[1] = productOrderLine;
        orderProcessingRequest.productOrderLines = productOrderLines;
        ws = CreateObject("webservice", "http://testservices.bitler.be/GenericServices/OrderProcessingService.svc?singleWsdl" );
        newOrder = ws.ProcessOrder(orderProcessingRequest); 
        writeoutput(newOrder);      
    </cfscript>             
</cffunction>

But it keeps throwing me errors at the line the function is invoked. I suspect I have an error in the "orderProcessingRequest", but I honestly can't figure out where.

Cannot perform web service invocation ProcessOrder.
The fault returned when invoking the web service operation is:

org.apache.axis2.AxisFault: There was an error while requesting your data. Please contact Bitler support with error ref (O150214084734).
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at org.tempuri.OrderProcessingServiceStub.processOrder(OrderProcessingServiceStub.java:193)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at coldfusion.xml.rpc.Axis2ServiceProxy.... ''


The error occurred in C:/ColdFusion10/cfusion/wwwroot/_cfc/febelco.cfc: line 43

41 :                orderProcessingRequest.productOrderLines = productOrderLines;
42 :                ws = CreateObject("webservice", "http://testservices.bitler.be/GenericServices/OrderProcessingService.svc?singleWsdl" ); //, { refreshWSDL=true, wsversion=1 } 
43 :                newOrder = ws.ProcessOrder(orderProcessingRequest); 
44 :                writeoutput(newOrder);      
45 :            </cfscript>             

Sincerely, Jurgen

  • I don't actually know, but it might have something to do with CF arrays being different than .net arrays. – Dan Bracuk Feb 14 '15 at 14:02
  • I'll look into that. I just noticed that that array is defined as a complex type, which makes me wonder if I couldn't get away with using a struct. This made me dig deeper until I stumbled on this: http://www.coldfusionmuse.com/index.cfm/2009/4/27/array.CF.to.NET I'll play around with that for a while and see where it gets me ... – Jurgen Puype Feb 14 '15 at 14:43
  • Still no joy, any suggestions would be welcome ... – Jurgen Puype Feb 16 '15 at 20:26

1 Answers1

0

Recently I was having some trouble with a webservice after moving from CF 9 to CF 10. We were connecting to the webservice via HTTPS so we had to import it's SSL certificate into the JVM (not relevant to you since I see that you are using a webservice via HTTP) and use {wsversion="1",refreshwsdl="true"} ?

What happens when you try changing it from

ws = CreateObject("webservice", "http://testservices.bitler.be/GenericServices/OrderProcessingService.svc?singleWsdl" ); //, { refreshWSDL=true, wsversion=1 }

to

ws = CreateObject("webservice", "http://testservices.bitler.be/GenericServices/OrderProcessingService.svc?singleWsdl", { refreshWSDL=true, wsversion=1 } );

?

Leigh
  • 28,765
  • 10
  • 55
  • 103
scott h
  • 11
  • 1