By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,354 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,354 IT Pros & Developers. It's quick & easy.

WSDL to SOAP

P: n/a
Hi all,

I want to Convert a WSDL to a SOAP message.

Is there any way to do this.

I am using .NET 2.0

Thanks in Advance
Siva
Oct 27 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You are confusing concepts here.
The WSDL is defining the service and its types.
SOAP is merely the protocol used for communication. It is like trying to
convert a cow to a chicken; not the most likely conversion.

BTW: What is actually your reasoning for this request?
--
rgds.
/Claus Konrad

"Siva" wrote:
Hi all,

I want to Convert a WSDL to a SOAP message.

Is there any way to do this.

I am using .NET 2.0

Thanks in Advance
Siva
Oct 27 '06 #2

P: n/a
Hi,

Thanks for your reply.

the wsdl will contain the xsd for the messages of an operations.

I want to generate a soap message template using that xsd, defined in the WSDL

by using xsd (WSDL) we can run a loop and generate it by programatically, my
question is , Is there any automated way like WSDL.exe, xsd.exe etc.?

Thanks in advance.

Thanks
Siva

"Claus Konrad" wrote:
You are confusing concepts here.
The WSDL is defining the service and its types.
SOAP is merely the protocol used for communication. It is like trying to
convert a cow to a chicken; not the most likely conversion.

BTW: What is actually your reasoning for this request?
--
rgds.
/Claus Konrad

"Siva" wrote:
Hi all,

I want to Convert a WSDL to a SOAP message.

Is there any way to do this.

I am using .NET 2.0

Thanks in Advance
Siva
Nov 1 '06 #3

P: n/a
"Siva" <Si**@discussions.microsoft.comwrote in message
news:67**********************************@microsof t.com...
Hi,

Thanks for your reply.

the wsdl will contain the xsd for the messages of an operations.

I want to generate a soap message template using that xsd, defined in the
WSDL

by using xsd (WSDL) we can run a loop and generate it by programatically,
my
question is , Is there any automated way like WSDL.exe, xsd.exe etc.?
What do you mean when you say "a soap message template"? WSDL.EXE and
XSD.EXE will both generate .NET classes. When your web service receives a
message, it will be deserialized into an object of the appropriate class.
When that web method returns, it will serialize the return object into SOAP
and will send it:

<?xml version="1.0"?>
<wsdl:definitions targetNamespace="urn:wsdl.example"
name="example"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ex="urn:example"
xmlns:tns="urn:wsdl.example"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
file:///c:/Program%20Files/Microsoft%20Visual%20Studio%208/Xml/Schemas/wsdl.xsd
http://schemas.xmlsoap.org/wsdl/soap/
file:///c:/Program%20Files/Microsoft%20Visual%20Studio%208/Xml/Schemas/wsdlSoap11Binding.xsd">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:example"
xmlns="urn:example">
<xsd:element name="Request">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="x"
type="xsd:int"/>
<xsd:element name="y"
type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Response">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="y"
type="xsd:int"/>
<xsd:element name="x"
type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="RequestMessage">
<wsdl:part name="parameter"
element="ex:Request">
</wsdl:part>
</wsdl:message>
<wsdl:message name="ResponseMessage">
<wsdl:part name="result"
element="ex:Response">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="examplePT">
<wsdl:operation name="MyOperation">
<wsdl:input message="tns:RequestMessage">
</wsdl:input>
<wsdl:output message="tns:ResponseMessage">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="example"
type="tns:examplePT">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"></soap:binding>
<wsdl:operation name="MyOperation">
<soap:operation style="document"
soapAction="urn:example"/>
<wsdl:input>
<soap:body use="literal"
parts="parameter"></soap:body>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"
parts="result"></soap:body>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="exampleService">
<wsdl:port name="examplePort"
binding="tns:example">
<soap:address location="http://example.com/MyService.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Running "wsdl /server" on this file will produce:

//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.2032
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

//
// This source code was auto-generated by wsdl, Version=1.1.4322.2032.
//
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Web.Services.WebServiceBindingAttribute(Nam e="example",
Namespace="urn:wsdl.example")]
public abstract class exampleService : System.Web.Services.WebService {

/// <remarks/>
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("urn:example",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("Resp onse",
Namespace="urn:example")]
public abstract Response
MyOperation([System.Xml.Serialization.XmlElementAttribute(Names pace="urn:example")]
Request Request);
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="urn:example")]
public class Request {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public int x;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public int y;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="urn:example")]
public class Response {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public int y;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public int x;
}

You can now create your webservice class by deriving from this:

public class MyExampleService : exampleService
{
public override Response MyOperation(Request Request)
{
Response response = new Response();
response.x = Request.x;
response.y = Request.y;
return response;
}
}
I hope that helps. I've left off details (and getting it to build) simply
because it's time for me to leave for work!

John
Nov 1 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.