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

Cannot map complex types in WSDL

P: n/a
hi

I have a java web service called "Registration service" and C# client
which is a consumer of that service

java web service running under Tomcat has following interface API
exposed

public RegistrationResponse registerDevice(RegistrationRequest regReq)
throws RemoteException

The code works like below:

1. During registering device suppose the server founds an exception
then it sets that exception inside Remote Exception and throw it.

For e,g
throw new RemoteException("Registration Web Service: " + message, e);
where e is the custom exception defined in RegistrationService on
server. For e,g "KeyNotFoundException" which drives
"DataModelException" which is again a custom exception

My WSDL file looks like below:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="RegistrationService"

targetNamespace="http://www.novell.com/zenworks/webservice/registration"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.novell.com/zenworks/webservice/registration"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"

targetNamespace="http://www.novell.com/zenworks/webservice/registration"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xs:element name="RegistrationRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="DeviceInformation">
<xs:complexType>
<xs:sequence>
<xs:element name="GUID" type="xs:string"/>
<xs:element name="OS" type="xs:string"/>
<xs:element name="HostName" type="xs:string"/>
<xs:element name="CPU" type="xs:string"/>
<xs:element name="DNS" type="xs:string"/>
<xs:element name="Port" type="xs:int"/>
<xs:element name="NetworkAddresses">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0"
name="NetworkAddress">
<xs:complexType>
<xs:sequence>
<xs:element name="IPAddress" type="xs:string"/>
<xs:element name="SubnetMask" type="xs:string"/>
<xs:element name="MACAddress" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="RegistrationCode"
type="xs:string"/>
<xs:element minOccurs="0" name="DeviceType" type="xs:string"/>
<xs:element minOccurs="0" name="Password" type="xs:string"/>
<xs:element minOccurs="0" name="Location" type="xs:string"/>
<xs:element minOccurs="0" name="AssetTag" type="xs:string"/>
<xs:element minOccurs="0" name="PrimaryAddress"
type="xs:string"/>
<xs:element minOccurs="0" name="Alias" type="xs:string"/>
<xs:element minOccurs="0" name="XenType" type="xs:string"/>
<xs:element minOccurs="0" name="XenHost" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RegistrationResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="DeviceName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="DataModelException">
<xs:sequence>
<xs:element name="messageText" type="xs:string"/>
<xs:element name="resourceKey" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="KeyNotFoundException">
<xs:complexContent>
<xs:extension base="tns:DataModelException">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<element name="string" type="xsd:string"/>
</xs:schema>
</types>
<message name="registerDeviceInput">
<part element="tns:RegistrationRequest" name="arg0"/>
</message>
<message name="registerDeviceOutput">
<part element="tns:RegistrationResponse" name="result"/>
</message>
<message name="pingInput"/>
<message name="pingOutput">
<part element="tns:string" name="result"/>
</message>
<portType name="Registration">
<operation name="registerDevice">
<input message="tns:registerDeviceInput"/>
<output message="tns:registerDeviceOutput"/>
</operation>
<operation name="ping">
<input message="tns:pingInput"/>
<output message="tns:pingOutput"/>
</operation>
</portType>
<binding name="RegistrationBinding" type="tns:Registration">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="registerDevice">
<soap:operation
soapAction="http://www.novell.com/zenworks/webservice/registration/registerDevice"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="ping">
<soap:operation
soapAction="http://www.novell.com/zenworks/webservice/registration/ping"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="RegistrationService">
<port binding="tns:RegistrationBinding" name="RegistrationPort">
<soap:address
location="http://localhost:8080/zenworks-registration/registration"/>
</port>
</service>
</definitions>
When I try to generate a C# stub by giving this wsdl file throwugh
WSDL.exe it looks like below

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

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

//
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Web.Services.WebServiceBindingAttribute(Nam e="RegistrationBinding",
Namespace="http://www.novell.com/zenworks/webservice/registration")]
public partial class RegistrationService :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {

private System.Threading.SendOrPostCallback
registerDeviceOperationCompleted;

private System.Threading.SendOrPostCallback pingOperationCompleted;

/// <remarks/>
public RegistrationService() {
this.Url =
"http://localhost:8080/zenworks-registration/registration";
}

/// <remarks/>
public event registerDeviceCompletedEventHandler
registerDeviceCompleted;

/// <remarks/>
public event pingCompletedEventHandler pingCompleted;

/// <remarks/>

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://www.novell.com/zenworks/webservice/registration/registerDevice",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return:
System.Xml.Serialization.XmlElementAttribute("Regi strationResponse",
Namespace="http://www.novell.com/zenworks/webservice/registration")]
public RegistrationResponse
registerDevice([System.Xml.Serialization.XmlElementAttribute(Names pace="http://www.novell.com/zenworks/webservice/registration")]
RegistrationRequest RegistrationRequest) {
object[] results = this.Invoke("registerDevice", new object[] {
RegistrationRequest});
return ((RegistrationResponse)(results[0]));
}

/// <remarks/>
public System.IAsyncResult BeginregisterDevice(RegistrationRequest
RegistrationRequest, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("registerDevice", new object[] {
RegistrationRequest}, callback, asyncState);
}

/// <remarks/>
public RegistrationResponse EndregisterDevice(System.IAsyncResult
asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((RegistrationResponse)(results[0]));
}

/// <remarks/>
public void registerDeviceAsync(RegistrationRequest
RegistrationRequest) {
this.registerDeviceAsync(RegistrationRequest, null);
}

/// <remarks/>
public void registerDeviceAsync(RegistrationRequest
RegistrationRequest, object userState) {
if ((this.registerDeviceOperationCompleted == null)) {
this.registerDeviceOperationCompleted = new
System.Threading.SendOrPostCallback(this.Onregiste rDeviceOperationCompleted);
}
this.InvokeAsync("registerDevice", new object[] {
RegistrationRequest},
this.registerDeviceOperationCompleted, userState);
}

private void OnregisterDeviceOperationCompleted(object arg) {
if ((this.registerDeviceCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEvent Args
invokeArgs =
((System.Web.Services.Protocols.InvokeCompletedEve ntArgs)(arg));
this.registerDeviceCompleted(this, new
registerDeviceCompletedEventArgs(invokeArgs.Result s, invokeArgs.Error,
invokeArgs.Cancelled, invokeArgs.UserState));
}
}

/// <remarks/>

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://www.novell.com/zenworks/webservice/registration/ping",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("stri ng",
Namespace="http://www.novell.com/zenworks/webservice/registration")]
public string ping() {
object[] results = this.Invoke("ping", new object[0]);
return ((string)(results[0]));
}

/// <remarks/>
public System.IAsyncResult Beginping(System.AsyncCallback callback,
object asyncState) {
return this.BeginInvoke("ping", new object[0], callback,
asyncState);
}

/// <remarks/>
public string Endping(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}

/// <remarks/>
public void pingAsync() {
this.pingAsync(null);
}

/// <remarks/>
public void pingAsync(object userState) {
if ((this.pingOperationCompleted == null)) {
this.pingOperationCompleted = new
System.Threading.SendOrPostCallback(this.OnpingOpe rationCompleted);
}
this.InvokeAsync("ping", new object[0],
this.pingOperationCompleted, userState);
}

private void OnpingOperationCompleted(object arg) {
if ((this.pingCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEvent Args
invokeArgs =
((System.Web.Services.Protocols.InvokeCompletedEve ntArgs)(arg));
this.pingCompleted(this, new
pingCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
invokeArgs.Cancelled, invokeArgs.UserState));
}
}

/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
public partial class RegistrationRequest {

private RegistrationRequestDeviceInformation
deviceInformationField;

/// <remarks/>
public RegistrationRequestDeviceInformation DeviceInformation {
get {
return this.deviceInformationField;
}
set {
this.deviceInformationField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
public partial class RegistrationRequestDeviceInformation {

private string gUIDField;

private string osField;

private string hostNameField;

private string cPUField;

private string dNSField;

private int portField;

private RegistrationRequestDeviceInformationNetworkAddress[]
networkAddressesField;

private string registrationCodeField;

private string deviceTypeField;

private string passwordField;

private string locationField;

private string assetTagField;

private string primaryAddressField;

private string aliasField;

private string xenTypeField;

private string xenHostField;

/// <remarks/>
public string GUID {
get {
return this.gUIDField;
}
set {
this.gUIDField = value;
}
}

/// <remarks/>
public string OS {
get {
return this.osField;
}
set {
this.osField = value;
}
}

/// <remarks/>
public string HostName {
get {
return this.hostNameField;
}
set {
this.hostNameField = value;
}
}

/// <remarks/>
public string CPU {
get {
return this.cPUField;
}
set {
this.cPUField = value;
}
}

/// <remarks/>
public string DNS {
get {
return this.dNSField;
}
set {
this.dNSField = value;
}
}

/// <remarks/>
public int Port {
get {
return this.portField;
}
set {
this.portField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("Ne tworkAddress",
IsNullable=false)]
public RegistrationRequestDeviceInformationNetworkAddress[]
NetworkAddresses {
get {
return this.networkAddressesField;
}
set {
this.networkAddressesField = value;
}
}

/// <remarks/>
public string RegistrationCode {
get {
return this.registrationCodeField;
}
set {
this.registrationCodeField = value;
}
}

/// <remarks/>
public string DeviceType {
get {
return this.deviceTypeField;
}
set {
this.deviceTypeField = value;
}
}

/// <remarks/>
public string Password {
get {
return this.passwordField;
}
set {
this.passwordField = value;
}
}

/// <remarks/>
public string Location {
get {
return this.locationField;
}
set {
this.locationField = value;
}
}

/// <remarks/>
public string AssetTag {
get {
return this.assetTagField;
}
set {
this.assetTagField = value;
}
}

/// <remarks/>
public string PrimaryAddress {
get {
return this.primaryAddressField;
}
set {
this.primaryAddressField = value;
}
}

/// <remarks/>
public string Alias {
get {
return this.aliasField;
}
set {
this.aliasField = value;
}
}

/// <remarks/>
public string XenType {
get {
return this.xenTypeField;
}
set {
this.xenTypeField = value;
}
}

/// <remarks/>
public string XenHost {
get {
return this.xenHostField;
}
set {
this.xenHostField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
public partial class RegistrationRequestDeviceInformationNetworkAddress
{

private string iPAddressField;

private string subnetMaskField;

private string mACAddressField;

/// <remarks/>
public string IPAddress {
get {
return this.iPAddressField;
}
set {
this.iPAddressField = value;
}
}

/// <remarks/>
public string SubnetMask {
get {
return this.subnetMaskField;
}
set {
this.subnetMaskField = value;
}
}

/// <remarks/>
public string MACAddress {
get {
return this.mACAddressField;
}
set {
this.mACAddressField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
public partial class RegistrationResponse {

private string deviceNameField;

/// <remarks/>
public string DeviceName {
get {
return this.deviceNameField;
}
set {
this.deviceNameField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
public delegate void registerDeviceCompletedEventHandler(object sender,
registerDeviceCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
public partial class registerDeviceCompletedEventArgs :
System.ComponentModel.AsyncCompletedEventArgs {

private object[] results;

internal registerDeviceCompletedEventArgs(object[] results,
System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}

/// <remarks/>
public RegistrationResponse Result {
get {
this.RaiseExceptionIfNecessary();
return ((RegistrationResponse)(this.results[0]));
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
public delegate void pingCompletedEventHandler(object sender,
pingCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("ws dl",
"2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
public partial class pingCompletedEventArgs :
System.ComponentModel.AsyncCompletedEventArgs {

private object[] results;

internal pingCompletedEventArgs(object[] results, System.Exception
exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}

/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
It does not seem to have mapping of "KeyNotFoundException" or
"DatamodelException".

so when remote exception is catch on client side and we try to print
message in it it say: "unable to serialize java.rmi.remoteException no
serializer found for "KeyNotFoundException"

Please let me know what needs to be done to handle such cases

Dec 28 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.