This is my WCF WSDL file.
<wsdl:portType name="IMyService">
<wsdl:operation name="add">
<wsdl:input wsaw:Action="http://pcname:9000/WcfService/MyService/IMyService/add"
message="tns:IMyService_add_InputMessage"/>
<wsdl:output wsaw:Action="http://pcname:9000/WcfService/MyService/IMyService/addResponse"
message="tns:IMyService_add_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="sub">
<wsdl:input wsaw:Action="http://pcname:9000/WcfService/MyService/IMyService/sub"
message="tns:IMyService_sub_InputMessage"/>
<wsdl:output wsaw:Action="http://pcname:9000/WcfService/MyService/IMyService/subResponse"
message="tns:IMyService_sub_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
I am trying to dynamically add reference to my project.
While reading WSDL dynamically I am getting an exception
Line in code:
ServiceDescriptionImportWarnings warning = importer.Import(nmspace, unit1);
Error:
Exception: Unable to import binding 'BasicHttpBinding_IMyService' from namespace http:// pcname:9000/WcfService/MyService/.
Inner excepetion : {"The element 'http:// pcname:9000/WcfService/MyService/:add' is missing."}
Why am I getting ":" (colon) before "add" function?
Related
Using Worklight 6.2.0.0.
I'm trying to consume one of our corporate web services via Worklight's HTTP Adapter. I have the WSDL for the web service, and I used the "Discover Backend Services" tool to generate the adapter JavaScript and XML.
The web service has 2 input parameters and 3 output parameters, all strings.
When I come to invoke the procedure on the client, I'm doing this:
var invocationData = {
adapter : 'messageHandlerAdapter',
procedure : 'messageHandlerService_messageHandler',
parameters : ['a','b']
};
var invocationOptions = {
onSuccess : messageHandlerSuccess,
onFailure : messageHandlerFailure
};
WL.Client.invokeProcedure(invocationData,invocationOptions);
You can see the dummy parameters in the invocationData array. Running this results in the following error:
java.lang.String cannot be cast to org.mozilla.javascript.Scriptable
If I remove the parameters, I don't get an error and the web service call appears to be successful, but I don't get any response (obviously).
A search on the forums led me to this:
http://stackoverflow.com/questions/23192346/class-cast-java-lang-string-cannot-be-cast-to-org-mozilla-javascript-scriptable
Which is along the same lines, and the response was that there might be an invalid JSON object somewhere. However, all I've done is used the auto-generated adapter code and called it.
I'm very new to Worklight, so any advice is gratefully received!
WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="messageHandler" targetNamespace="urn:messageHandler" xmlns:tns="urn:messageHandler" xmlns:S2="urn:messageHandler:messageHandler" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:S1="urn:soap-fault:details" xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation>EncodingType=DOC_LITERAL, WSA_Product=10.1A - N/A</wsdl:documentation>
<wsdl:types>
<schema elementFormDefault="unqualified" targetNamespace="urn:soap-fault:details" xmlns="http://www.w3.org/2001/XMLSchema"><element name="FaultDetail"><complexType><sequence><element name="errorMessage" type="xsd:string"/><element name="requestID" type="xsd:string"/></sequence></complexType></element></schema>
<schema elementFormDefault="qualified" targetNamespace="urn:messageHandler:messageHandler" xmlns="http://www.w3.org/2001/XMLSchema"><element name="messageHandler"><complexType><sequence><element name="ipMessageParams" nillable="true" type="xsd:string"/><element name="ipMessageData" nillable="true" type="xsd:string"/></sequence></complexType></element><element name="messageHandlerResponse"><complexType><sequence><element name="result" nillable="true" type="xsd:string"/><element name="opMessageResponse" nillable="true" type="xsd:string"/><element name="opMessageData" nillable="true" type="xsd:string"/></sequence></complexType></element></schema>
</wsdl:types>
<wsdl:message name="messageHandler_messageHandlerResponse">
<wsdl:part name="parameters" element="S2:messageHandlerResponse"/>
</wsdl:message>
<wsdl:message name="FaultDetailMessage">
<wsdl:part name="FaultDetail" element="S1:FaultDetail"/>
</wsdl:message>
<wsdl:message name="messageHandler_messageHandler">
<wsdl:part name="parameters" element="S2:messageHandler"/>
</wsdl:message>
<wsdl:portType name="messageHandlerObj">
<wsdl:operation name="messageHandler">
<wsdl:input message="tns:messageHandler_messageHandler"/>
<wsdl:output message="tns:messageHandler_messageHandlerResponse"/>
<wsdl:fault name="messageHandlerFault" message="tns:FaultDetailMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="messageHandlerObj" type="tns:messageHandlerObj">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="messageHandler">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="messageHandlerFault">
<soap:fault name="messageHandlerFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="messageHandlerService">
<wsdl:port name="messageHandlerObj" binding="tns:messageHandlerObj">
<documentation></documentation>
<soap:address location="redacted"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Here is a link to a pic of the Service description in Project Explorer.
Generally we pass XML to SOAP based web services. With the case to worklight we have to convert XML to JSON and pass it to adapter. Considering your input SOAP is like
<a>
<b>value1</b>
<c>value2</c>
</a>
Your JSON for above XML would be
params= {
a:{
b:value1,
c:value2
}
}
So u will have to pass above JSON as parameter
headers={
"SOAPAction": "YOUR ACTION NAME"
}
And so your adapter call will look like this,
var invocationData = {
adapter : 'messageHandlerAdapter',
procedure : 'messageHandlerService_messageHandler',
parameters : [params,headers]
};
var invocationOptions = {
onSuccess : messageHandlerSuccess,
onFailure : messageHandlerFailure
};
WL.Client.invokeProcedure(invocationData,invocationOptions);
You currently have a service under your 'services' folder in your project.
In Project Explorer view right-click on your service and it should show you a sample parameter to be passed to the messageHandlerService_messageHandler procedure:
You can copy this sample JSON and invoke the adapter procedure by pasting and setting the sample values to your desired values:
If you also need to pass custom HTTP headers you should add a comma after the parameter JSON and add another JSON string with the custom headers.
I have a WCF web service project (VB.NET 3.5), and the WSDL it generates does not have the input and output names, like this:
<wsdl:operation name="getListing">
<soap:operation soapAction="getListing" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
I need the input and output names to be defined in the WSDL, like this:
<wsdl:operation name="getListing">
<wsdlsoap:operation soapAction="getListing"/>
<wsdl:input name="getListingRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getListingResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
This is the definition for the method in question:
<OperationContract(Action:="getListing")> _
<WebMethod(Description:="Retrieve Base64 binary.", EnableSession:=True)> _
Public Overloads Overrides Function getListing(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://namespacehere.com")> ByVal getListingRequest As ListingRequest) As ListingResponse
I feel like I'm missing something stupid, does anyone know what it is? There are so many options and parameters, I can't find the right ones that determine this.
I have been trying to generate a Proxy class in VB.NET using a WSDL file for an Apache Axis SOAP Web Service.
They have provided me the WSDL file and when I use the WSDL.exe command (In Visual Studio 08) and point it to the local path I get an error.
wsdl /language:vb c:\Orders.wsdl
(I am trying to create a .NET Client that consumes the SOAP Web Service Hosted on Apache Axis 2)
The Error
Unable to import binding 'OrdersSoapBinding' from namespace 'urn:company:orders:schemas:OrderTypes:1.00'.
-Unable to import operation 'placeOrder'
-The element 'urn:company:remtp:schemas:PlaceOrderRequest:1.00:PlaceOrderRequest' is missing
if you would like more help, please type 'wsdl /?'
If I use the svcutil.exe I also get an error message...
svcutil.exe C:\Orders.wsdl /t:code /l:VB /o:"C:\Orders.VB"
What is causing the problem?
Your help will be much appreciated, Thank you.
WSDL Code
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="urn:company:orders:schemas:OrderTypes:1.00"
xmlns:impl="urn:company:orders:schemas:OrderTypes:1.00"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:poreq="urn:company:remtp:schemas:PlaceOrderRequest:1.00"
xmlns:poresp="urn:company:remtp:schemas:PlaceOrderResponse:1.00"
xmlns:coreq="urn:company:remtp:schemas:CommitOrderRequest:1.00"
xmlns:coresp="urn:company:remtp:schemas:CommitOrderResponse:1.00"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:company:orders:schemas:OrderTypes:1.00">
<import namespace="urn:company:remtp:schemas:PlaceOrderRequest:1.00" schemaLocation="../schemas/placeOrderRequest.xsd"/>
<import namespace="urn:company:remtp:schemas:PlaceOrderResponse:1.00" schemaLocation="../schemas/placeOrderResponse.xsd"/>
<import namespace="urn:company:remtp:schemas:CommitOrderRequest:1.00" schemaLocation="../schemas/commitOrderRequest.xsd"/>
<import namespace="urn:company:remtp:schemas:CommitOrderResponse:1.00" schemaLocation="../schemas/commitOrderResponse.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="placeOrderRequest">
<wsdl:part element="poreq:PlaceOrderRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="placeOrderResponse">
<wsdl:part element="poresp:PlaceOrderResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="commitOrderRequest">
<wsdl:part element="coreq:CommitOrderRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="commitOrderResponse">
<wsdl:part element="coresp:CommitOrderResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Orders">
<wsdl:operation name="placeOrder">
<wsdl:input message="impl:placeOrderRequest"/>
<wsdl:output message="impl:placeOrderResponse"/>
</wsdl:operation>
<wsdl:operation name="commitOrder">
<wsdl:input message="impl:commitOrderRequest"/>
<wsdl:output message="impl:commitOrderResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="OrdersSoapBinding" type="impl:Orders">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="placeOrder">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="placeOrderRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="placeOrderResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="commitOrder">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="commitOrderRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="commitOrderResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrdersService">
<wsdl:port name="Orders" binding="impl:OrdersSoapBinding">
<wsdlsoap:address location="https://companyorders.co.uk/endpoints/services/Orders"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Looking into the wsdl file you provided, You'll see references to four xsd (xml xchema document) files: they contain the type definitions and validation rules needed by svcutil to create the proxy.
<import namespace="urn:company:remtp:schemas:PlaceOrderRequest:1.00" schemaLocation="../schemas/placeOrderRequest.xsd"/>
<import namespace="urn:company:remtp:schemas:PlaceOrderResponse:1.00" schemaLocation="../schemas/placeOrderResponse.xsd"/>
<import namespace="urn:company:remtp:schemas:CommitOrderRequest:1.00" schemaLocation="../schemas/commitOrderRequest.xsd"/>
<import namespace="urn:company:remtp:schemas:CommitOrderResponse:1.00" schemaLocation="../schemas/commitOrderResponse.xsd"/>
So, You need those xsd files too
I've a web service created using WCF. It uses CustomException as well.
When i use Axis 2 to generate java code from it (WSDL2JAVA) it thorws the following error:
> IWAB0399 Error in generating java from WSDL
> Missing <soap:fault> element inFault Operation "CustomExceptionFault" in operation "CustomExceptionFault", in binding
> GetPDFs
> java.io.IOException: ERROR: Missing <soap:fault> element inFault "CustomExceptionFault" in operation "CustomExceptionFault", in binding
> GetPDFs at
> org.apache.axis.wsdl.symbolTable.SymbolTable.faultFromSOAPFault(Unknown
> Source)
My WSDL snippet
<wsdl:binding name="tdsServiceSoap12" type="tns:ITDSService">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetPDFs">
<soap12:operation soapAction="http://tempuri.org/ITDSService/GetPDFs" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="CustomExceptionFault">
<soap12:fault name="CustomExceptionFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
Hope it clarifies. If need further information please let me know.
Regards
This article helped me solve my problem with some other tweaks.
http://weblogs.asp.net/pglavich/archive/2010/03/16/making-wcf-output-a-single-wsdl-file-for-interop-purposes.aspx
Warning 1 Custom tool warning: Cannot import wsdl:binding
Detail: The given key was not present in the dictionary.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://wrapper.dao.ccarwebservice.ids.com']/wsdl:binding[#name='CCaRWebServiceHttpBinding'] C:\Users\me\Documents\Visual Studio 2008 \Projects\CcarsWcfTest\CcarsWcfTest\Service References\ServiceReference1\Reference.svcmap 1 1 CcarsWcfTest
what can I do to resolve this issue?
I've tried running the service utility from the command prompt and adding a service reference to my project. I've also gone into the advanced setting in the Add Service Reference dialog and deselected 'Reuse types in all referenced assemblies'.
EDIT
Here is the part of the wsdl I think it's referring to..
<wsdl:binding name="CCaRWebServiceHttpBinding" type="ns:CCaRWebServicePortType">
<http:binding verb="POST"/>
<wsdl:operation name="fnGetccarprogramsummaryarray">
<http:operation location="CCaRWebService/fnGetccarprogramsummaryarray"/>
<wsdl:input>
<mime:content type="text/xml" part="fnGetccarprogramsummaryarray"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="fnGetccarprogramsummaryarray"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="fnGetccarprogramsummary">
<http:operation location="CCaRWebService/fnGetccarprogramsummary"/>
<wsdl:input>
<mime:content type="text/xml" part="fnGetccarprogramsummary"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="fnGetccarprogramsummary"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
public partial class fnGetccarprogramsummaryarrayRequest
{
public fnGetccarprogramsummaryarrayRequest()
{
}
}
the others are like this...
public partial class fnGetccarprogramsummaryRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://wrapper.com", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string programAcronym;
public fnGetccarprogramsummaryRequest()
{
}
public fnGetccarprogramsummaryRequest(string programAcronym)
{
this.programAcronym = programAcronym;
}
}
Where did the WSDL come from? How was it generated?
It could be the the definition of the input and return types are missing.
fnGetccarprogramsummaryarray
fnGetccarprogramsummary.
It could be that it is trying to look for the definition in an array of types and not finding it.
EDIT
I think that I found it you have a POST binding and the tool only supports a SOAP binding
http://social.msdn.microsoft.com/Forums/en/wcf/thread/859a2c87-02db-469d-ab65-c558ff091e61
The key that is not present is then the SOAP binding.
After searching.. the only solution I've come across is to ignore this error.
"It is internal implementation detail of svcutil.
The error is probably since the wsdl contains a POST binding and the utlity only works on SOAP bindings. But if there is another SOAP binding in the wsdl it works."