I have simple remoting server exposing following simple method. When I try to
add webreference to this server in another project,
it gives me following error:
Custom tool error: Unable to import WebService/Schema. Unable to import
binding 'MyRemoteObject Binding' from namespace
'http://schemas.microso ft.com/clr/nsassem/RemoteServer/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull'.
Unable to import operation 'GetEmpInfo'.
The datatype
'http://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s/Brooks.EES.Fram ework.DataStruc ture%2C%20Versi on%3D1.0.1.1%2C %20Culture%3Dne utral%2C%20Publ icKeyToken%3Dbb f6413da47c0685: EmpDetail' is missing.
After some tests, following are my findings.
1. Currently EmpDetail class is defined in different namespace and different
DLL from the remoting server.
2. In this setup, ?wsdl generates wsdl which is missing the type definition
of the EmpDetails, which is resulting in above error.
3. If I remove get/set methods from the EmpDetail class, ?wsdl generates
correct wsdl with EmpDetalis type definition in the wsdl.
4. If I define EmpDetails class in the same namesapce and same dll (no
change in the EmpDetails definition), ?wsdl generates correct wsdl with the
type definition of EmpDetail calss.
Im I missing something? or How can I instruct ?wsdl to include all type
definition.
----------------------------------------------------------------------------
Example Code: RemoteServer
----------------------------------------------------------------------------
using Brooks.EES.Fram ework.DataAcces s;
namespace RemoteServer
{
class MyRemoteObject : System.MarshalB yRefObject
{
public EmpDetail GetEmpInfo()
{
return new EmpDetail();
}
}
}
namespace Brooks.EES.Fram ework.DataAcces s
{
[Serializable]
public class EmpDetail
{
private string _Id;
private string _description;
public string Id
{
get
{
return _Id;
}
set
{
_Id = value;
}
}
public string Description
{
get
{
return _description;
}
set
{
_description = value;
}
}
}
}
-----------------------------------------------------------------------------
Here is the wsdl snipate which is missing type definition.
-----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="MyRemoteO bject"
targetNamespace ="http://schemas.microso ft.com/clr/nsassem/RemoteServer/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull"
xmlns="http://schemas.xmlsoap .org/wsdl/"
xmlns:tns="http ://schemas.microso ft.com/clr/nsassem/RemoteServer/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:suds="htt p://www.w3.org/2000/wsdl/suds"
xmlns:wsdl="htt p://schemas.xmlsoap .org/wsdl/"
xmlns:soapenc=" http://schemas.xmlsoap .org/soap/encoding/"
xmlns:ns2="http ://schemas.microso ft.com/clr/nsassem/RemoteServer.My RemoteObject/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull"
xmlns:ns0="http ://schemas.microso ft.com/clr/nsassem/RemoteServer/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull"
xmlns:ns1="http ://schemas.microso ft.com/clr/ns/System"
xmlns:ns3="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s/Brooks.EES.Fram ework.DataStruc ture%2C%20Versi on%3D1.0.1.1%2C %20Culture%3Dne utral%2C%20Publ icKeyToken%3Dbb f6413da47c0685"
xmlns:ns4="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture%2C%20Versi on%3D1.0.1.1%2C %20Culture%3Dne utral%2C%20Publ icKeyToken%3Dbb f6413da47c0685"
xmlns:soap="htt p://schemas.xmlsoap .org/wsdl/soap/">
<message name="MyRemoteO bject.GetEmpInf oInput">
</message>
<message name="MyRemoteO bject.GetEmpInf oOutput">
<part name="return" type="ns3:EmpDe tail"/>
</message>
<portType name="MyRemoteO bjectPortType">
<operation name="GetEmpInf o">
<input name="GetEmpInf oRequest"
message="tns:My RemoteObject.Ge tEmpInfoInput"/>
<output name="GetEmpInf oResponse"
message="tns:My RemoteObject.Ge tEmpInfoOutput"/>
</operation>
</portType>
<binding name="MyRemoteO bjectBinding" type="tns:MyRem oteObjectPortTy pe">
<soap:binding style="rpc"
transport="http ://schemas.xmlsoap .org/soap/http"/>
<suds:class type="ns0:MyRem oteObject" rootType="Marsh alByRefObject">
</suds:class>
<operation name="GetEmpInf o">
<soap:operati on
soapAction="htt p://schemas.microso ft.com/clr/nsassem/RemoteServer.My RemoteObject/RemoteServer#Ge tEmpInfo"/>
<suds:method attributes="pub lic"/>
<input name="GetEmpInf oRequest">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/RemoteServer.My RemoteObject/RemoteServer"/>
</input>
<output name="GetEmpInf oResponse">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/RemoteServer.My RemoteObject/RemoteServer"/>
</output>
</operation>
</binding>
<message name="EmpDetail .get_IdInput">
</message>
<message name="EmpDetail .get_IdOutput">
<part name="return" type="xsd:strin g"/>
</message>
<message name="EmpDetail .set_IdInput">
<part name="value" type="xsd:strin g"/>
</message>
<message name="EmpDetail .set_IdOutput">
</message>
<message name="EmpDetail .get_Descriptio nInput">
</message>
<message name="EmpDetail .get_Descriptio nOutput">
<part name="return" type="xsd:strin g"/>
</message>
<message name="EmpDetail .set_Descriptio nInput">
<part name="value" type="xsd:strin g"/>
</message>
<message name="EmpDetail .set_Descriptio nOutput">
</message>
<portType name="EmpDetail PortType">
<operation name="get_Id">
<input name="get_IdReq uest" message="tns:Em pDetail.get_IdI nput"/>
<output name="get_IdRes ponse"
message="tns:Em pDetail.get_IdO utput"/>
</operation>
<operation name="set_Id" parameterOrder= "value">
<input name="set_IdReq uest" message="tns:Em pDetail.set_IdI nput"/>
<output name="set_IdRes ponse"
message="tns:Em pDetail.set_IdO utput"/>
</operation>
<operation name="get_Descr iption">
<input name="get_Descr iptionRequest"
message="tns:Em pDetail.get_Des criptionInput"/>
<output name="get_Descr iptionResponse"
message="tns:Em pDetail.get_Des criptionOutput"/>
</operation>
<operation name="set_Descr iption" parameterOrder= "value">
<input name="set_Descr iptionRequest"
message="tns:Em pDetail.set_Des criptionInput"/>
<output name="set_Descr iptionResponse"
message="tns:Em pDetail.set_Des criptionOutput"/>
</operation>
</portType>
<binding name="EmpDetail Binding" type="tns:EmpDe tailPortType">
<soap:binding style="rpc"
transport="http ://schemas.xmlsoap .org/soap/http"/>
<suds:class type="ns3:EmpDe tail">
</suds:class>
<operation name="get_Id">
<soap:operati on
soapAction="htt p://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture#get_Id"/>
<suds:method attributes="pub lic"/>
<input name="get_IdReq uest">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture"/>
</input>
<output name="get_IdRes ponse">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture"/>
</output>
</operation>
<operation name="set_Id">
<soap:operati on
soapAction="htt p://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture#set_Id"/>
<suds:method attributes="pub lic"/>
<input name="set_IdReq uest">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture"/>
</input>
<output name="set_IdRes ponse">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture"/>
</output>
</operation>
<operation name="get_Descr iption">
<soap:operati on
soapAction="htt p://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture#get_Descri ption"/>
<suds:method attributes="pub lic"/>
<input name="get_Descr iptionRequest">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture"/>
</input>
<output name="get_Descr iptionResponse" >
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture"/>
</output>
</operation>
<operation name="set_Descr iption">
<soap:operati on
soapAction="htt p://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture#set_Descri ption"/>
<suds:method attributes="pub lic"/>
<input name="set_Descr iptionRequest">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture"/>
</input>
<output name="set_Descr iptionResponse" >
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s.EmpDetail/Brooks.EES.Fram ework.DataStruc ture"/>
</output>
</operation>
</binding>
<service name="MyRemoteO bjectService">
<port name="MyRemoteO bjectPort" binding="tns:My RemoteObjectBin ding">
<soap:address location="http://localhost:8086/x.MyTest"/>
</port>
</service>
</definitions>
-----------------------------------------------------------------
Here is the correct wsdl with type information:
------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="MyRemoteO bject"
targetNamespace ="http://schemas.microso ft.com/clr/nsassem/RemoteServer/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull"
xmlns="http://schemas.xmlsoap .org/wsdl/"
xmlns:tns="http ://schemas.microso ft.com/clr/nsassem/RemoteServer/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:suds="htt p://www.w3.org/2000/wsdl/suds"
xmlns:wsdl="htt p://schemas.xmlsoap .org/wsdl/"
xmlns:soapenc=" http://schemas.xmlsoap .org/soap/encoding/"
xmlns:ns2="http ://schemas.microso ft.com/clr/nsassem/RemoteServer.My RemoteObject/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull"
xmlns:ns0="http ://schemas.microso ft.com/clr/nsassem/RemoteServer/RemoteServer%2C %20Version%3D1. 0.0.0%2C%20Cult ure%3Dneutral%2 C%20PublicKeyTo ken%3Dnull"
xmlns:ns1="http ://schemas.microso ft.com/clr/ns/System"
xmlns:ns3="http ://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s/Brooks.EES.Fram ework.DataStruc ture%2C%20Versi on%3D1.0.1.1%2C %20Culture%3Dne utral%2C%20Publ icKeyToken%3Dbb f6413da47c0685"
xmlns:soap="htt p://schemas.xmlsoap .org/wsdl/soap/">
<types>
<schema
targetNamespace ="http://schemas.microso ft.com/clr/nsassem/Brooks.EES.Fram ework.DataAcces s/Brooks.EES.Fram ework.DataStruc ture%2C%20Versi on%3D1.0.1.1%2C %20Culture%3Dne utral%2C%20Publ icKeyToken%3Dbb f6413da47c0685"
xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefa ult="unqualifie d"
attributeFormDe fault="unqualif ied">
<element name="EmpDetail " type="ns3:EmpDe tail"/>
<complexType name="EmpDetail ">
<all>
<element name="_Id" type="xsd:strin g"/>
<element name="_descript ion" type="xsd:strin g"/>
</all>
</complexType>
</schema>
</types>
<message name="MyRemoteO bject.GetEmpInf oInput">
</message>
<message name="MyRemoteO bject.GetEmpInf oOutput">
<part name="return" type="ns3:EmpDe tail"/>
</message>
<portType name="MyRemoteO bjectPortType">
<operation name="GetEmpInf o">
<input name="GetEmpInf oRequest"
message="tns:My RemoteObject.Ge tEmpInfoInput"/>
<output name="GetEmpInf oResponse"
message="tns:My RemoteObject.Ge tEmpInfoOutput"/>
</operation>
</portType>
<binding name="MyRemoteO bjectBinding" type="tns:MyRem oteObjectPortTy pe">
<soap:binding style="rpc"
transport="http ://schemas.xmlsoap .org/soap/http"/>
<suds:class type="ns0:MyRem oteObject" rootType="Marsh alByRefObject">
</suds:class>
<operation name="GetEmpInf o">
<soap:operati on
soapAction="htt p://schemas.microso ft.com/clr/nsassem/RemoteServer.My RemoteObject/RemoteServer#Ge tEmpInfo"/>
<suds:method attributes="pub lic"/>
<input name="GetEmpInf oRequest">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/RemoteServer.My RemoteObject/RemoteServer"/>
</input>
<output name="GetEmpInf oResponse">
<soap:body use="encoded"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"
namespace="http ://schemas.microso ft.com/clr/nsassem/RemoteServer.My RemoteObject/RemoteServer"/>
</output>
</operation>
</binding>
<portType name="EmpDetail PortType">
</portType>
<binding name="EmpDetail Binding" type="tns:EmpDe tailPortType">
<soap:binding style="rpc"
transport="http ://schemas.xmlsoap .org/soap/http"/>
<suds:class type="ns3:EmpDe tail">
</suds:class>
</binding>
<service name="MyRemoteO bjectService">
<port name="MyRemoteO bjectPort" binding="tns:My RemoteObjectBin ding">
<soap:address location="http://localhost:8086/x.MyTest"/>
</port>
</service>
</definitions>