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
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 } );
?
Related
I'm attempting to describe the following kind of structure using XSD 1.0:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:all>
<xs:element name="A" minOccurs="1" maxOccurs="1">
<xs:element name="B" minOccurs="1" maxOccurs="1">
<xs:element name="C" minOccurs="1" maxOccurs="1">
<xs:element name="D" minOccurs="0" maxOccurs="unbounded">
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
for the following minimal example document:
<?xml version="1.0" encoding="utf-8"?>
<root><D/><D/><D/><C/><D/><D/><A/><B/><D/></root>
This does not work, since XSD 1.0 does not allow unbounded occurances of an element inside <xs:all>. Since this corresponds to a regex such as (D*AD*BD*CD*|D*AD*CD*BD*|D*BD*AD*CD*|D*CD*AD*BD*|D*BD*CD*AD*|D*CD*BD*AD*), I tried replacing the inner <xs:all> … </xs:all> with the following:
<xs:choice>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:choice>
but when checked using xmllint, the tool (quite rightly) complains that the content model is not determinist. Is there a way?
Here we have some solutions:
Option 1: Make you regex solution determinist
The following is your regex transforme to a deterministic regex (please allow me this regex abuse of notation):
d*
(
ad*(bd*c|cd*b)
|
bd*(ad*c|cd*a)
|
cd*(ad*b|bd*a)
)
d*
Transformed to XSD:
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:sequence>
<xs:element name="A"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:sequence>
<xs:element name="B"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C"/>
</xs:sequence>
<xs:sequence>
<xs:element name="C"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A"/>
</xs:sequence>
</xs:choice>
</xs:sequence>
<xs:sequence>
<xs:element name="B"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:sequence>
<xs:element name="A"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C"/>
</xs:sequence>
<xs:sequence>
<xs:element name="C"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A"/>
</xs:sequence>
</xs:choice>
</xs:sequence>
<xs:sequence>
<xs:element name="C"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:sequence>
<xs:element name="A"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B"/>
</xs:sequence>
<xs:sequence>
<xs:element name="B"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A"/>
</xs:sequence>
</xs:choice>
</xs:sequence>
</xs:choice>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
Option 2: Use xs:key (only valid for simple content or simple types)
Keys should be unique, always present (and non-nullable). If a xs:key field selects more than one value the document is invalid, so you can use:
<xs:element name="root">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="A" type="xs:string"/>
<xs:element name="B" type="xs:string"/>
<xs:element name="C" type="xs:string"/>
<xs:element name="D" type="xs:string"/>
</xs:choice>
</xs:complexType>
<xs:key name="oneABC">
<xs:selector xpath="."/>
<xs:field xpath="A"/>
<xs:field xpath="B"/>
<xs:field xpath="C"/>
</xs:key>
</xs:element>
Option 3: Change XML model to enforce order
Not exactly a solution as this won't validate the same documents. This would be a lot easier if you only accept a given order. This is only possible if you are the one defining XML document instances structure. Example: ABCD*
<xs:sequence>
<xs:element name="A">
<xs:element name="B">
<xs:element name="C">
<xs:element name="D" minOccurs="0" maxOccurs="unbounded">
</xs:sequence>
Option 4: best solution, use XSD 1.1 and xs:assert
Not a real option as you say you need XSD 1.0, but just in case someone can use XSD 1.1. This is super-easy using XSD 1.1 and xs:assert:
<xs:element name="root">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="A"/>
<xs:element name="B"/>
<xs:element name="C"/>
<xs:element name="D"/>
</xs:choice>
<xs:assert test="count(A)=1 and count(B)=1 and count(C)=1"/>
</xs:complexType>
</xs:element>
I have a client that connects to a SOAP server endpoint:
Endpoint.publish("http://localhost:8081/todo", new ToDoWebService());
The server offers the next simple method:
#WebService
public class ToDoWebService {
#WebMethod()
public String addToDo(String task, String context, String project, int priority) {
return "ToDo: \n "
+ "\t Task : "+task+"\n"
+ "\t Context : "+context+"\n"
+ "\t Project : "+project+"\n"
+ "\t Priority: "+priority;
}
}
This is the client:
public class Client {
public static void main(String[] args) {
ToDoWebServiceService tdwss = new ToDoWebServiceService();
ToDoWebService tdws = tdwss.getToDoWebServicePort();
System.out.println(tdws.addToDo("Task 1","My Context","My Project",9));
}
}
The thing is that the connection between client and server is succesful, but not entirely: the pass of the arguments from the client to the service is not made as expected, been this the result on the client once executed:
The server doesn't receive correctly the arguments that the client has passed with the method "addToDo()" call. It returns the string format expected but with nulls instead the arguments passed by the client. And that's what I can't figure out...
Of course, I'm pretty confident the WSDL file is well written:
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8 svn-revision#13980. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8 svn-revision#13980. -->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://todows.bigws/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://todows.bigws/" name="ToDoWebServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://todows.bigws/" schemaLocation="toDo.xsd"/>
</xsd:schema>
</types>
<message name="addToDo">
<part name="parameters" element="tns:addToDo"/>
</message>
<message name="addToDoResponse">
<part name="parameters" element="tns:addToDoResponse"/>
</message>
<portType name="ToDoWebService">
<operation name="addToDo">
<input wsam:Action="http://todows.bigws/ToDoWebService/addToDo" message="tns:addToDo"/>
<output wsam:Action="http://todows.bigws/ToDoWebService/addToDoResponse" message="tns:addToDoResponse"/>
</operation>
</portType>
<binding name="ToDoWebServicePortBinding" type="tns:ToDoWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="addToDo">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="ToDoWebServiceService">
<port name="ToDoWebServicePort" binding="tns:ToDoWebServicePortBinding">
<soap:address location="http://localhost:8081/todo"/>
</port>
</service>
</definitions>
As well as the schema "toDo.xsd":
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8 svn-revision#13980. -->
<xs:schema xmlns:tns="http://todows.bigws/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://todows.bigws/">
<xs:element name="addToDo" type="tns:addToDo"/>
<xs:element name="addToDoResponse" type="tns:addToDoResponse"/>
<xs:complexType name="addToDo">
<xs:sequence>
<xs:element name="task" type="xs:string" minOccurs="0"/>
<xs:element name="context" type="xs:string" minOccurs="0"/>
<xs:element name="project" type="xs:string" minOccurs="0"/>
<xs:element name="priority" type="xs:int" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="addToDoResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
I've tried different actions in the server method, as writing the string with the parameter in a file, but the result is the same, an error cause the parameters are null. That's what I think proves that the failure is located in the way the server receive the parameters passed to the "addToDo()" method.
I've review the WSDL & schema files over and over....but I've not been able to find what make this code run wrongly. I've also tested this code with the SoapUI software and the outcome is the same.
¿Any ideas?
P.D.: Sorry about all the posted code.
In case you need the whole project: my SOAP project at GitHub
I reviewed your WSDL and XSD in your project todows-cli-ws and the problem is the WSDL and XSD files in your client project are outdated!
For example, this is the current content of the XSD file of your server.
<xs:schema xmlns:tns="http://todows.bigws/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0" targetNamespace="http://todows.bigws/">
<xs:element name="addToDo" type="tns:addToDo"/>
<xs:element name="addToDoResponse" type="tns:addToDoResponse"/>
<xs:element name="listToDo" type="tns:listToDo"/>
<xs:element name="listToDoResponse" type="tns:listToDoResponse"/>
<xs:element name="removeToDo" type="tns:removeToDo"/>
<xs:element name="removeToDoResponse" type="tns:removeToDoResponse"/>
<xs:complexType name="addToDo">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0"/>
<xs:element name="arg1" type="xs:string" minOccurs="0"/>
<xs:element name="arg2" type="xs:string" minOccurs="0"/>
<xs:element name="arg3" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="addToDoResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="removeToDo">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="removeToDoResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="listToDo">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="listToDoResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Note that the current name of the params are arg0, arg1, arg2 and arg3. The server expects as param names task, context, project and priority, and therefore the method is invoked with the default values (null for a String and 0 for an int).
We have used Web Services with Delphi in the past and those are simple with few parameters and returned a single value to the client. A new service we working should able to XML input and receive XML output.
Is there any componenet which can be used for this purpose?
When i tried using like below am getting an error "Exception in SearchAgreements input parameter XmlElement - System.NullReferenceException: Object reference not set to an instance of an object."
LDocument := NewXMLDocument;
<<framed an XML input>>
DocSearchOut := SearchArgsResponse.Create();
DoxSerchIn := SearchArgs.Create();
DoxSerchIn.SOAPTOObject(LDocument.DocumentElement,LDocument.DocumentElement,HTTPRIO1.Converter);
DoxService := GetIDoxService(True,'',HTTPRIO1);
DocSearchOut :=DoxService.SearchAgreements(DoxSerchIn)
I even tried converting SearchArgs as widestring and tried to pass as a string.This is working with minor changes on HTTPRIO execute. Final Edit
LDocument := NewXMLDocument;
<<framed an XML input>>
DocSearchOut := SearchArgsResponse.Create();
DoxSerchIn := SearchArgs.Create();
DoxSerchIn.SearchArgs := LDocument.DocumentElement.XML;
DoxService := GetIDoxService(True,'',HTTPRIO1);
DocSearchOut :=DoxService.SearchAgreements(DoxSerchIn)
its wsdl
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://www.bank.com/dox/service/v1.0.0" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="DoxService" targetNamespace="http://tempuri.org/">
<wsdl:import namespace="http://www.bank.com/dox/service/v1.0.0" location="http://devldn.ldn.bank.com:8258/doxManual/DoxService.svc?wsdl=wsdl0"/>
<wsdl:types/>
<wsdl:binding name="BasicHttpBinding_IDoxService" type="i0:IDoxService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SearchAgreements">
<soap:operation soapAction="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreements" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DoxService">
<wsdl:port name="BasicHttpBinding_IDoxService" binding="tns:BasicHttpBinding_IDoxService">
<soap:address location="http://devldn.ldn.bank.com:8258/doxManual/DoxService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
wsdl0
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://www.bank.com/dox/service/v1.0.0" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" targetNamespace="http://www.bank.com/dox/service/v1.0.0">
<wsdl:types>
<xsd:schema targetNamespace="http://www.bank.com/dox/service/v1.0.0/Imports">
<xsd:import schemaLocation="http://ldndev.ldn.bank.com:8258/doxManual/DoxService.svc?xsd=xsd0" namespace="http://www.bank.com/dox/service/v1.0.0"/>
<xsd:import schemaLocation="http://ldndev.ldn.bank.com:8258/doxManual/DoxService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IDoxService_SearchAgreements_InputMessage">
<wsdl:part name="parameters" element="tns:SearchAgreements"/>
</wsdl:message>
<wsdl:message name="IDoxService_SearchAgreements_OutputMessage">
<wsdl:part name="parameters" element="tns:SearchAgreementsResponse"/>
</wsdl:message>
<wsdl:portType name="IDoxService">
<wsdl:operation name="SearchAgreements">
<wsdl:input wsaw:Action="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreements" message="tns:IDoxService_SearchAgreements_InputMessage"/>
<wsdl:output wsaw:Action="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreementsResponse" message="tns:IDoxService_SearchAgreements_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>
xsd0
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.bank.com/dox/service/v1.0.0" elementFormDefault="qualified" targetNamespace="http://www.bank.com/dox/service/v1.0.0">
<xs:element name="SearchAgreements">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="searchRequest" nillable="true">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" processContents="lax"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SearchAgreementsResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="SearchAgreementsResult" nillable="true">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" processContents="lax"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
xsd1
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
<xs:element name="boolean" nillable="true" type="xs:boolean"/>
<xs:element name="byte" nillable="true" type="xs:byte"/>
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
<xs:element name="decimal" nillable="true" type="xs:decimal"/>
<xs:element name="double" nillable="true" type="xs:double"/>
<xs:element name="float" nillable="true" type="xs:float"/>
<xs:element name="int" nillable="true" type="xs:int"/>
<xs:element name="long" nillable="true" type="xs:long"/>
<xs:element name="QName" nillable="true" type="xs:QName"/>
<xs:element name="short" nillable="true" type="xs:short"/>
<xs:element name="string" nillable="true" type="xs:string"/>
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
<xs:element name="char" nillable="true" type="tns:char"/>
<xs:simpleType name="char">
<xs:restriction base="xs:int"/>
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration"/>
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid"/>
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName"/>
<xs:attribute name="Id" type="xs:ID"/>
<xs:attribute name="Ref" type="xs:IDREF"/>
</xs:schema>
Input to Service..unfortunetely,team has added few things so unable to retrieve output on SOAP UI.
<AgreementSearchRequest xmlns="http://www.bank.com/dox/service/v1.0.0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<PageNo>1</PageNo>
<PageSize>10</PageSize>
<Source>IBFD</Source>
</Header>
<SearchCriteria>
<AgreementId>10</AgreementId>
<AgreementStatus>Search Status</AgreementStatus>
<AgreementType>Search Type</AgreementType>
<AgreementVersion>Search Version</AgreementVersion>
<CompletedDate>2014-05-30T15:56:45.7533005+05:30</CompletedDate>
<ContractingEntity>Search GCRS Code</ContractingEntity>
<CounterpartyBranch>Search CP Branch</CounterpartyBranch>
<CounterpartyEMID>Search CP EMID</CounterpartyEMID>
<CounterpartyId>Search CP ID</CounterpartyId>
<CounterpartyName>Search CP Name</CounterpartyName>
<CounterpartyType>Search CP Type</CounterpartyType>
<CreditContact>Search Contact</CreditContact>
<IsOffshoreUser>true</IsOffshoreUser>
<Products>
<Product>
<ProductCode>Search Code</ProductCode>:=
<ProductName i:nil="true"/>
</Product>
</Products>
<RXM>Search RXM</RXM>
<RequestedDate>2014-05-30T15:56:45.758183+05:30</RequestedDate>
<bankLegalEntity>Search LEgal Entity</bankLegalEntity>
<bankLegalEntityCategory>Search Legal Entity Category</bankLegalEntityCategory>
<UmbrellaCounterpartyEMID>Search Agent EMID</UmbrellaCounterpartyEMID>
<UmbrellaCounterpartyName>Search Agent Name</UmbrellaCounterpartyName>
</SearchCriteria>
I tried importing xsd and replacing xml file HTTPRIO Before execute as mentioned here..
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://www.bank.com/dox/service/v1.0.0" elementFormDefault="qualified" targetNamespace="http://www.bank.com/dox/service/v1.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ArrayOfProduct">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Product" nillable="true" type="tns:Product" />
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfProduct" nillable="true" type="tns:ArrayOfProduct" />
<xs:complexType name="Product">
<xs:sequence>
<xs:element minOccurs="0" name="ProductCode" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="ProductName" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="Product" nillable="true" type="tns:Product" />
<xs:complexType name="AgreementSearchRequest">
<xs:sequence>
<xs:element name="Header" nillable="true" type="tns:AgreementSearchRequestHeader" />
<xs:element name="SearchCriteria" nillable="true" type="tns:AgreementSearchCriteria" />
</xs:sequence>
</xs:complexType>
<xs:element name="AgreementSearchRequest" nillable="true" type="tns:AgreementSearchRequest" />
<xs:complexType name="AgreementSearchRequestHeader">
<xs:sequence>
<xs:element name="PageNo" type="xs:int" />
<xs:element name="PageSize" type="xs:int" />
<xs:element name="Source" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="AgreementSearchRequestHeader" nillable="true" type="tns:AgreementSearchRequestHeader" />
<xs:complexType name="AgreementSearchCriteria">
<xs:sequence>
<xs:element minOccurs="0" name="AgreementId" type="xs:int" />
<xs:element minOccurs="0" name="AgreementStatus" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="AgreementType" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="AgreementVersion" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CompletedDate" type="xs:dateTime" />
<xs:element minOccurs="0" name="ContractingEntity" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyBranch" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyEMID" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyId" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyName" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyType" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CreditContact" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="Products" nillable="true" type="tns:ArrayOfProduct" />
<xs:element minOccurs="0" name="RXM" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="RequestedDate" type="xs:dateTime" />
<xs:element minOccurs="0" name="egalEntity" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="LegalEntityCategory" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="UmbrellaCounterpartyEMID" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="UmbrellaCounterpartyName" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="AgreementSearchCriteria" nillable="true" type="tns:AgreementSearchCriteria" />
</xs:schema>
There is the Web Service Toolkit.
It has a code generator that takes a wsdl and generate Pascal classes from it that interact with the web service.
Seems to be exactly what you need, but I do not know the specifics.
Then there are also my Internet Tools for FreePascal (not Delphi).
They contain interpreter for XQuery which is a general purpose XML processing language, so you can use it with every possible XML/HTML based API with far less code than using DOM methods. But it won't help you with anything WSDL specific, you need to write the XML for every request yourself.
Based on other views on vaiours forums(inc stack overflow) we have fixed the issue by fixing in 2 places.
Changed the remotable procedure generated by Delphi.Earlier it was a class of input parameter itself so we have changed to WideString
SearchAgreements = class(TRemotable)
private
FsearchRequest: WideString ;
FsearchRequest_Specified: boolean;
procedure SetsearchRequest(Index: Integer; const AsearchRequest: WideString );
function searchRequest_Specified(Index: Integer): boolean;
public
destructor Destroy; override;
published
property searchRequest: WideString Index (IS_OPTN) read FsearchRequest write SetsearchRequest stored searchRequest_Specified;
end;
And also we have modified HTTPRIO Before execute with minor modifications and we are able to send XML sucessfully to Service.
procedure HTTPRIO1SoapBeforeExecute(const MethodName: string;
SOAPRequest: TStream);
var
StrTemp,Fheader : TStringList;
StrBeg,StrEnd,StrParam,StrParam1 : TStringList;
StreamTemp : TStream;
StrLst : TStringList;
StrLstTmp: TStringList;
begin
StrBeg:=TStringList.Create();
StrEnd:=TStringList.Create();
SOAPRequest.Position := 0;
StrTemp.LoadFromStream(SOAPRequest);
StrBeg.Text := StringReplace(StrTemp.Text,'<','<',[RfReplaceAll]);
StrEnd.Text := StringReplace(StrBeg.Text,'>','>',[RfReplaceAll]);
SOAPRequest.Position:=0;
SOAPRequest.Size := 0; //Clear the Stream
StrEnd.SaveToStream(SOAPRequest); //Reinitialise the stream with right string.
SOAPRequest.Position :=0;
end;
We have done PHd on Webservices call with,so anyone facing similar issue can contact me.Thanks:)
I usually consume SOAP webservices with CFHTTP and post the XML as a HTTP parameter. However, this time I am trying to consume a webservice with createObject, but when I pass the XML as an argument to the webservice ws.someMethod(args);, it fails. I tried using a struct to hold the parameter values, but that also did not work. As such, how do one pass the parameters? The partial WSDL is below
<xs:element name="ORDER">
<xs:complexType>
<xs:sequence>
<xs:element name="Header" type="schemaOne:HeaderType"/>
<xs:element maxOccurs="unbounded" name="Detail" type="schemaOne:DetailType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="DetailType">
<xs:sequence>
<xs:element ref="schemaOne:DTORDN"/>
<xs:element ref="schemaOne:DTRCID"/>
<xs:element ref="schemaOne:DTPRT"/>
<xs:element ref="schemaOne:DTQTY"/>
<xs:element ref="schemaOne:DTNTU"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderType">
<xs:sequence>
<xs:element ref="schemaOne:DSORDN"/>
<xs:element ref="schemaOne:DSRCID"/>
<xs:element ref="schemaOne:DSBFNM"/>
<xs:element ref="schemaOne:DSBLNM"/>
<xs:element minOccurs="0" ref="schemaOne:DSBENT"/>
<xs:element ref="schemaOne:DSBAD1"/>
<xs:element minOccurs="0" ref="schemaOne:DSBAD2"/>
<xs:element minOccurs="0" ref="schemaOne:DSBAD3"/>
<xs:element ref="schemaOne:DSBAD4"/>
<xs:element ref="schemaOne:DSBSTT"/>
<xs:element ref="schemaOne:DSBZIP"/>
<xs:element ref="schemaOne:DSBCNT"/>
</xs:sequence>
</xs:complexType>
Here's the struct I've constructed.
<cfscript>
ORDER = {};
ORDER.Header = {};
ORDER.Detail = {};
ORDER.Header.DSORDN = '251716';
ORDER.Header.DSRCID = 'H';
ORDER.Header.DSBFNM = 'Joe';
ORDER.Header.DSBLNM = 'Smith';
ORDER.Header.DSBAD1 = '4997 County Road';
ORDER.Header.DSBAD4 = 'Springfield';
ORDER.Header.DSBSTT = 'MO';
ORDER.Header.DSBZIP = '49657';
ORDER.Header.DSBCNT = 'USA';
ORDER.Detail.DTORDN = '251716';
ORDER.Detail.DTRCID = 'D';
ORDER.Detail.DTPRT = '0300604';
ORDER.Detail.DTQTY = '0000000000001';
ORDER.Detail.DTNTU = '00000009.9900';
</cfscript>
i am working with unit tests at the moment and where trying to pass an xml file to my Webservice. I just saved the xml Files i needed inside external files and read them with "FileRead" inside cfscript. This is how i did it
<cfscript>
input = FileRead("http.....");
mycomponent = createObject("component", "component.beginning.from.root");
mycomponent.methodName(input);
</cfscript>
but i had to change my code because before i parsed the content of the HttpRequest to xml and where looking for the expected elements. Now i use the incoming file and look immediately for the elements i want instead of parsing because its already xml
<cfset var body = xmlsearch(arguments.input, "//soapenv:body")[1] />
if you're interested in the code of my webservice just look here
You have to consume SOAP web services that expect complex data type with CFC that mirrors the expected structure instead of passing the XML. See this
I am migrating my webservice publishing API from AXIS2 to CXF. CXF autogenerated WSDL is not similar to Axis2 WSDL. There are given below differences. As client sits somewhere else I am not able to test if these differences will affect Axis2 generated clients. How can remove these WSDL differences using CXF?
CXF WSDL
<xs:element name="test" type="tns:test"/>
<xs:element name="testResponse" type="tns:testResponse"/>
<xs:complexType name="test">
<xs:sequence> <xs:element name="doc" type="xs:string" minOccurs="0"/> </xs:sequence>
</xs:complexType>
<xs:complexType name="testResponse">
<xs:sequence> <xs:element name="return" type="xs:string" minOccurs="0"/> </xs:sequence>
</xs:complexType>
<wsdl:portType name="TESTService">
Axis2 WSDL
<xsd:element name="test" nillable="true" type="xsd:string" />
<xsd:element name="testResponse" nillable="true" type="xsd:string" />
<wsdl:portType name="TEST">
Most likely, adding an annotation of:
#SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
would do it. You may also need to update "name" attributes of the #WebParam and #WebReturn params.
To get rif of xs:elemntName difference, remove '#WebParams' from web service input as it is accepting just a String not any complex object.
To remove wsdl:portType name difference, just added '#WebService(name) attribute. '#WebService' should be as per the specification order else cxf won't consider them in WSDL.