XSD import using WSDL.exe

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Here is my problem. I have a serviced component that is exposed via a SOAP
interface. This particular component, Person, has a method that takes in
another object called PersonHobby. When I try and use wsdl.exe, it always
fails on the method "AddHobby" which takes in the PersonHobby.

Here is what I enter on the command line:
wsdl /out:C:\proxies\Person.cs
http://development4/Demo/DAL_Demo.Entities.Person.soap?WSDL
"C:\PersonHobby.xsd"

Here is the error:
Error: Unable to import binding 'PersonBinding' from namespace
'http://schemas.
icrosoft.com/clr/nsassem/DAL_Demo.Entities/DAL_Demo.Entities%2C%20Version%3D1.0.
0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D87d46b0839097fa7'.
- Unable to import operation 'AddHobby'.
- The datatype
'http://schemas.microsoft.com/clr/nsassem/DAL_Demo.Entities/DA
_Demo.Entities%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken
%3D87d46b0839097fa7:PersonHobby' is missing.

Here is my xsd:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="PersonHobby" type="PersonHobby" nillable="true"/>
<xs:complexType name="PersonHobby" mixed="false">
<xs:complexContent mixed="false">
<xs:extension base="ServicedComponent">
<xs:sequence>
<xs:element name="PersonID" type="xs:int"/>
<xs:element name="HobbyID" type="xs:int"/>
<xs:element name="Hobby" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ServicedComponent" abstract="true" mixed="false">
<xs:complexContent mixed="false">
<xs:extension base="ContextBoundObject"/>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ContextBoundObject" abstract="true" mixed="false">
<xs:complexContent mixed="false">
<xs:extension base="MarshalByRefObject"/>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MarshalByRefObject" abstract="true"/>
</xs:schema>

Here is the namespace in my WSDL
xmlns:ns5="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=87d46b0839097fa7"

You will be my hero of the day if you can help me. Thanks in advance.

Pete
 
Hello Pete,

Could you show the class DAL_Demo.Entities.Person ?

PW> Hi,
PW>
PW> Here is my problem. I have a serviced component that is exposed via
PW> a SOAP interface. This particular component, Person, has a method
PW> that takes in another object called PersonHobby. When I try and use
PW> wsdl.exe, it always fails on the method "AddHobby" which takes in
PW> the PersonHobby.
PW>
PW> Here is what I enter on the command line:
PW> wsdl /out:C:\proxies\Person.cs
PW> http://development4/Demo/DAL_Demo.Entities.Person.soap?WSDL
PW> "C:\PersonHobby.xsd"
PW> Here is the error:
PW> Error: Unable to import binding 'PersonBinding' from namespace
PW> 'http://schemas.m
PW> icrosoft.com/clr/nsassem/DAL_Demo.Entities/DAL_Demo.Entities%2C%20Ve
PW> rsion%3D1.0.
PW> 0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D87d46b0839097fa7'.
PW> - Unable to import operation 'AddHobby'.
PW> - The datatype
PW> 'http://schemas.microsoft.com/clr/nsassem/DAL_Demo.Entities/DAL
PW> _Demo.Entities%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20Pu
PW> blicKeyToken %3D87d46b0839097fa7:PersonHobby' is missing.
PW>
PW> Here is my xsd:
PW> <?xml version="1.0" encoding="utf-8"?>
PW> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
PW> elementFormDefault="qualified">
PW> <xs:element name="PersonHobby" type="PersonHobby" nillable="true"/>
PW> <xs:complexType name="PersonHobby" mixed="false">
PW> <xs:complexContent mixed="false">
PW> <xs:extension base="ServicedComponent">
PW> <xs:sequence>
PW> <xs:element name="PersonID" type="xs:int"/>
PW> <xs:element name="HobbyID" type="xs:int"/>
PW> <xs:element name="Hobby" type="xs:string" minOccurs="0"/>
PW> </xs:sequence>
PW> </xs:extension>
PW> </xs:complexContent>
PW> </xs:complexType>
PW> <xs:complexType name="ServicedComponent" abstract="true"
PW> mixed="false">
PW> <xs:complexContent mixed="false">
PW> <xs:extension base="ContextBoundObject"/>
PW> </xs:complexContent>
PW> </xs:complexType>
PW> <xs:complexType name="ContextBoundObject" abstract="true"
PW> mixed="false">
PW> <xs:complexContent mixed="false">
PW> <xs:extension base="MarshalByRefObject"/>
PW> </xs:complexContent>
PW> </xs:complexType>
PW> <xs:complexType name="MarshalByRefObject" abstract="true"/>
PW> </xs:schema>
PW> Here is the namespace in my WSDL:
PW> xmlns:ns5="http://schemas.microsoft.com/clr/nsassem/DAL_Demo.Entitie
PW> s.PersonHobby/DAL_Demo.Entities%2C%20Version%3D1.0.0.0%2C%20Culture%
PW> 3Dneutral%2C%20PublicKeyToken%3D87d46b0839097fa7"
PW> You will be my hero of the day if you can help me. Thanks in
PW> advance.
PW>
PW> Pete
PW>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Michael,

Thanks for your time. I will post it tomorrow as the code is at work
(9:00pm). But if this will help, the offesive method looks like this:

public void AddHobby(PersonHobby ph)
{
hobbies.Add(ph);
}

Where hobbies is an ArrayList. I will post it in full tomorow unless you
let me know otherwise. Thanks again.

Pete
 
Hello Pete,

I hope you aren't trying to generate code for PrivateComponent.
WSDL can't see PersonHobby class, but you need to post the code demonstrating
your problem, because for the code below
it generate code successfully

namespace ClassLibrary1
{
public class Class1: ServicedComponent
{
public ArrayList hobbies;
public Class1()
{
}
public void AddHobby(PersonHobby ph)
{
hobbies.Add(ph);
}
}

[PrivateComponent]
public class Class2: ServicedComponent
{
public Class2()
{
}
}
}
namespace ClassLibrary2
{
public class PersonHobby
{
public string GetInfo()
{
return "my string";
}
};
}


PW> Michael,
PW>
PW> Thanks for your time. I will post it tomorrow as the code is at
PW> work (9:00pm). But if this will help, the offesive method looks
PW> like this:
PW>
PW> public void AddHobby(PersonHobby ph)
PW> {
PW> hobbies.Add(ph);
PW> }
PW> Where hobbies is an ArrayList. I will post it in full tomorow
PW> unless you let me know otherwise. Thanks again.
PW>
PW> Pete
PW>
PW> "Michael Nemtsev" wrote:
PW>---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Hi Michael,

Here is the code as promised. Neither Person or Person Hobby is a
PrivateComponent. I wanted to get it working before I introduced any
PrivateComponents. While I am very new to wsdl, I am almost positive the
problem is either the xsd schema for PersonHobby or a namespace in the wsdl
for Person.

Person:
namespace DAL_Demo.Entities
{

public class Person : ServicedComponent
{
private int personID;
private string title;
private string firstName;
private string lastName;
private string email;
private string phoneNumber;
private double bankAccount;
private ArrayList hobbies;

public Person(){}
..
..//other constuctors
..

public void InitializeCollections()
{
hobbies = new ArrayList();
}


public void AddHobby(PersonHobby aHobby)
{
hobbies.Add(aHobby);
}

..
.. //other methods
..
}
}

PersonHobby:
namespace DAL_Demo.Entities
{

public class PersonHobby : ServicedComponent
{
private int personID;
private int hobbyID;
private string hobby;

public PersonHobby() { }

public PersonHobby(int aPersonID, int aHobbyID, string aHobby)
{
personID = aPersonID;
hobbyID = aHobbyID;
hobby = aHobby;
}
..
..//getters and setters
..
}
}

Just for clarification as to why I think the xsd or the wsdl is the problem,
here is the error message when I use wsdl.exe on the Person wsdl link without
the PersonHobby xsd:

This command:
wsdl /out:C:\proxies\Person.cs
http://development4/Demo/DAL_Demo.Entities.Person.soap?WSDL

Produces this error:
Error: Unable to import binding 'PersonBinding' from namespace
'http://schemas.microsoft.com/clr/nsassem/DAL_Demo.Entities/DAL_Demo.Entities, Version=1.0.
0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D87d46b0839097fa7'.
- Unable to import operation 'AddHobby'.
- The datatype
'http://schemas.microsoft.com/clr/nsassem/DAL_Demo.Entities/DAL
_Demo.Entities%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken
%3D87d46b0839097fa7:PersonHobby' is missing.

And this(includes the xsd):
wsdl /out:C:\proxies\Person.cs
http://development4/Demo/DAL_Demo.Entities.Person.soap?WSDL
"C:\PersonHobby.xsd"

Produces the same error. Thanks again for your help.

Pete
 
Hello Pete,

Try to create new project with that code you pointed. I can't see the reason
where it could be flawed - it works fine.

I'd assume that smth wrong with GAC assembly or with installed COM+ component
into ComponentServices.
Try to do following:

1) Remove component from ComponentServices
2) Remove GAC assembly
3) Recompile component (be sure that it's signed)
4) Use gacutil to install assembly into GAC
5) Use regsvcs to install component into ComponentService
6) Check application EventLog that none error is exists
7) load IE to see that component description is exist
8) call you "wsdl /out:http://<server>/<directory>/DAL_Demo.Entities.Person.soap?WSDL"
and you got generated class with some warnings


PW> Hi Michael,
PW>
PW> Here is the code as promised. Neither Person or Person Hobby is a
PW> PrivateComponent. I wanted to get it working before I introduced
PW> any PrivateComponents. While I am very new to wsdl, I am almost
PW> positive the problem is either the xsd schema for PersonHobby or a
PW> namespace in the wsdl for Person.
PW>
PW> Person:
PW> namespace DAL_Demo.Entities
PW> {
PW> public class Person : ServicedComponent
PW> {
PW> private int personID;
PW> private string title;
PW> private string firstName;
PW> private string lastName;
PW> private string email;
PW> private string phoneNumber;
PW> private double bankAccount;
PW> private ArrayList hobbies;
PW> public Person(){}
PW> .
PW> .//other constuctors
PW> .
PW> public void InitializeCollections()
PW> {
PW> hobbies = new ArrayList();
PW> }
PW> public void AddHobby(PersonHobby aHobby)
PW> {
PW> hobbies.Add(aHobby);
PW> }
PW> .
PW> . //other methods
PW> .
PW> }
PW> }
PW> PersonHobby:
PW> namespace DAL_Demo.Entities
PW> {
PW> public class PersonHobby : ServicedComponent
PW> {
PW> private int personID;
PW> private int hobbyID;
PW> private string hobby;
PW> public PersonHobby() { }
PW>
PW> public PersonHobby(int aPersonID, int aHobbyID, string
PW> aHobby)
PW> {
PW> personID = aPersonID;
PW> hobbyID = aHobbyID;
PW> hobby = aHobby;
PW> }
PW> .
PW> .//getters and setters
PW> .
PW> }
PW> }
PW> Just for clarification as to why I think the xsd or the wsdl is the
PW> problem, here is the error message when I use wsdl.exe on the Person
PW> wsdl link without the PersonHobby xsd:
PW>
PW> This command: wsdl /out:C:\proxies\Person.cs
PW> http://development4/Demo/DAL_Demo.Entities.Person.soap?WSDL
PW>
PW> Produces this error:
PW> Error: Unable to import binding 'PersonBinding' from namespace
PW> 'http://schemas.microsoft.com/clr/nsassem/DAL_Demo.Entities/DAL_Demo
PW> .Entities%2C%20Version%3D1.0.
PW> 0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D87d46b0839097fa7'.
PW> - Unable to import operation 'AddHobby'.
PW> - The datatype
PW> 'http://schemas.microsoft.com/clr/nsassem/DAL_Demo.Entities/DAL
PW> _Demo.Entities%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20Pu
PW> blicKeyToken %3D87d46b0839097fa7:PersonHobby' is missing.
PW>
PW> And this(includes the xsd):
PW> wsdl /out:C:\proxies\Person.cs
PW> http://development4/Demo/DAL_Demo.Entities.Person.soap?WSDL
PW> "C:\PersonHobby.xsd"
PW> Produces the same error. Thanks again for your help.
PW>
PW> Pete
PW>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Back
Top