Reputation: 33
I have an asmx Web Service. In my wsdl, i guess port type and binding names generated by default. What i want is to change those names.How can i do that? Is it related with config file or only c# code can handle this. What way do you suggest to have wsdl like below. Thanks for responses!
My wsdl:
<wsdl:message name="sendDocumentSoap12In">
<wsdl:part name="document" element="tns:documentRequest"/>
</wsdl:message>
<wsdl:message name="sendDocumentSoap12Out">
<wsdl:part name="sendDocumentResult" element="tns:documentResponse"/>
</wsdl:message>
<wsdl:portType name="EFaturaSoap12">
<wsdl:operation name="sendDocument">
<wsdl:input message="tns:sendDocumentSoap12In"/>
<wsdl:output message="tns:sendDocumentSoap12Out"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="EFaturaSoap12" type="tns:EFaturaSoap12">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sendDocument">
<soap12:operation soapAction="sendDocument" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
wsdl i want:
<wsdl:message name="sendDocument">
<wsdl:part element="tns:documentRequest" name="document"></wsdl:part>
</wsdl:message>
<wsdl:message name="sendDocumentResponse">
<wsdl:part element="tns:documentResponse" name="sendDocumentReturn"></wsdl:part>
</wsdl:message>
<wsdl:portType name="EFaturaPortType">
<wsdl:operation name="sendDocument">
<wsdl:input message="tns:sendDocument" name="sendDocument"></wsdl:input>
<wsdl:output message="tns:sendDocumentResponse" name="sendDocumentResponse"></wsdl:output>
<wsdl:fault message="tns:EFaturaFaultMessage" name="EFaturaFaultMessage"></wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="EFaturaSoapBinding" type="tns:EFaturaPortType">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sendDocument">
<soap12:operation soapAction="sendDocument" style="document"/>
<wsdl:input name="sendDocument">
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output name="sendDocumentResponse">
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="EFaturaFaultMessage">
<soap12:fault name="EFaturaFaultMessage" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
Upvotes: 3
Views: 1856
Reputation: 1743
You can say, WSDL is your config file here.You can change it manually but carefully, like you did above. You need to check all references for changing value in wsdl. Like above,you need to edit service tag also with new edited binding name.
Any webservice implementation, in any language gives you limited control over these names.You can control thses names in a limit.
Like in jax-ws (JAVA API for XML webservice). You can define your operation name based on your method or interface name and port type depends on your class name. Normally while generating wsdl input message: MethodNameRequest and output message:MethodNameResponse is generated.I hope C# also gives you similar implementation.
Usually in wsdl,
• The portType element can be compared to a function library (or a module, or a class) in a traditional programming language.
• The operation element can be compared to a method in a traditional programming language.
• The message element defines the data elements of an operation or method (input/output).
If you want to do these changes frequently with wsdl, you can write a DOM parser to generate wsdl with changes as per your requirement.
Upvotes: 1