Hi Anne, I discovered that this was happening because of a very stupid mistake of my own. But now a new problems have come up. I am making a .Net Client for a PDA. when I try to generate the client side proxy using the wsdl.exe available for VS.Net 2003 from the deployed web service (wsdl /namespace:HelloWorld http://craftgepc18.epfl.ch:8080/axis/services/HelloServerPort?wsdl) I get the following error:
--------------------------------------------------- Error: There was an error processing 'http://craftgepc18.epfl.ch:8080/axis/servi ces/HelloServerPort?wsdl'. - The document at the url http://craftgepc18.epfl.ch:8080/axis/services/HelloS erverPort?wsdl was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'WSDL Document' is 'There is an error in XML document (44, 6).'. - More than one message part named 'intElement' was specified. Each message pa rt must have a unique name. - Report from 'DISCO Document' is 'Discovery document at the URL http://craftgep c18.epfl.ch:8080/axis/services/HelloServerPort?wsdl could not be found.'. - The document format is not recognized. - Report from 'XML Schema' is 'Expected Schema root. Make sure that the root ele ment is <schema> and the namespace is 'http://www.w3.org/2001/XMLSchema' for an XSD schema or 'urn:schemas-microsoft-com:xml-data' for an XDR schema. An error o ccurred at , (2, 2).'. If you would like more help, please type "wsdl /?". ---------------------------------------------------- But if I try to generate the client side proxy from the WSDL that I wrote (wsdl /namespace:HelloWorld C:\c-sharp\helloServerWSDL\HelloServer.wsdl) it works. Using this proxy I created my client and tried calling the webservice but got the following error this time : -------------------------------------------------- InvalidOperationException Server found request content type to be 'text/html;charset=ISO-8859-1',but expected 'text/xml'. -------------------------------------------------- I had got the same error before when I tried to write the interface first and then use the java2wsdl and wsdl2java tools to build the server. I am attaching the wsdl that i wrote (HelloServer.wsdl), the wsdl generated when i view it through a browser (generated.wsdl), the proxy file generated for HelloServer.wsl (HelloServer.cs) and the client (Form1.cs). I would really be grateful if some one could help me with this. Thanks and regards, Nitesh ----- Original Message ----- From: NITESH GUPTA <[EMAIL PROTECTED]> Date: Tuesday, June 1, 2004 6:16 pm Subject: Re: RE: java.io.IOException: Emitter failure. There is an undefined binding (HelloServerBinding) in the WSDL document. > Hi Anne, > > Thanks a lot for the help. The WSDL editor and your pointers > proved to be of great help. I was able to generate the Java files > using WSDL2Java tool. I made the appropriate additions to the > files (HelloServerBindingImpl.java), made a jar file containing > all the class files and copied it to > %TOMCAT_HOME%\webapps\axis\WEB-INF\lib. I deployed the service > using the command : > > java org.apache.axis.client.AdminClient deploy.wsdd > > this deploy.wsdd was generated along with the other java files > using WSDL2Java. I am getting the message > > Processing file deploy.wsdd > <Admin>Done processing > > but when I try to look at the wsdl through my browser > (http://craftgepc18.epfl.ch:8080/axis/services/HelloServer?wsdl) it gives the error > > AXIS error > > Sorry, something seems to have gone wrong... here are the details: > > Exception - java.lang.reflect.InvocationTargetException > > Do i need to make changes to the deploy.wsdd too or is it some > other problem? > > Thanks again for your help, > Nitesh > > ----- Original Message ----- > From: Anne Thomas Manes <[EMAIL PROTECTED]> > Date: Tuesday, June 1, 2004 3:39 pm > Subject: RE: java.io.IOException: Emitter failure. There is an > undefined binding (HelloServerBinding) in the WSDL document. > > > Nitesh, > > > > I agree that your QNames look okay, but there are quite a few > > problems with > > your WSDL. You've got a serious mix and match of RPC/encoded and > > document/literal definitions. > > > > I think your specific error is caused by the way you've defined your > > <soap:body> elements: > > > > <soap:body > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > > > 1) you have "namespace" spelled wrong (so perhaps wsdl2java > > ignored the > > binding definition -- hence no binding was defined) > > 2) you should not use the "encodingStyle" and the "namespace" > > attributes on > > document/literal bindings. > > > > Your <soap:body> elements should be defined like this: > > > > <soap:body use="literal"/> > > > > You also have typos in some of your message names: > > > > <message name="sayHellToRequest"> > > <part name="name" type="xsd:string"/> > > </message> > > > > Some basic guidelines for doc/literal bindings: > > - Don't use the soapenc:array type. Define your own array using the > > minOccurs and maxOccurs attributes. > > - You have only one message part per message. That message part must > > reference an element definition rather than a type definition. > > - To use the Wrapped style, the referenced element definition > must > > have the > > same name as the portType operation name. The element must be > > defined as a > > <sequence>. The operation parameters are defined as elements > > within the > > sequence. > > > > For example, your addRequest message should be defined like this: > > > > <message name="addRequest"> > > <part name="parameters" element="tns:add"/> > > </message> > > > > And the add element should be defined like this: > > > > <element name="add"> > > <complexType> > > <sequence> > > <element name="num1" type="xsd:int"/> > > <element name="num2" type="xsd:int"/> > > </sequence> > > </complexType> > > </element> > > > > I suggest you get a WSDL editor to help you define your WSDL > > documents. The > > Cape Clear SOA Editor is free. See > > http://www.capescience.com/soa/index.shtml > > > > Anne > > > > -----Original Message----- > > From: NITESH GUPTA [EMAIL PROTECTED] > > Sent: Tuesday, June 01, 2004 6:15 AM > > To: [EMAIL PROTECTED] > > Subject: java.io.IOException: Emitter failure. There is an > > undefined binding > > (HelloServerBinding) in the WSDL document. > > > > Hi, > > > > I got the error : > > > > java.io.IOException: Emitter failure. There is an undefined binding > > (HelloServerBinding) in the WSDL document. > > Hint: make sure <port binding=".."> is fully qualified. > > > > I checked my WSDL file and everything seems ok. I'm not able to > > figure out > > why I am getting this error. > > > > I have included the WSDL file below. > > > > Any help is appreciated. > > Thanks in advance, > > Nitesh > > > > > > <?xml version="1.0" encoding="UTF-8"?> > > <definitions name="HelloServer" > > targetnamespace="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > xmlns="http://schemas.xmlsoap.org/wsdl/" > > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" > > xmlns:tns="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > xmlns:xsd1="http://craft.epfl.ch/schema"> > > > > <types> > > <xsd:schema > > > > targetnamespace="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > xmlns="http://www.w3.org/2001/XMLSchema" > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> > > > > <xsd:complexType name="ArrayOfString"> > > <xsd:complexContent> > > <xsd:restriction > > base="soapenc:Array"> > > <xsd:attribute > > ref="soapenc:arrayType" wsdl:arrayType="string[]"/> > > </xsd:restriction> > > </xsd:complexContent> > > </xsd:complexType> > > > > <xsd:complexType name="HelloUser"> > > <xsd:sequence> > > <xsd:element name="userID" > > type="xsd:int"/> > > <xsd:element name="userName" > > nillable="true" type="xsd:string"/> > > <xsd:element maxOccurs="unbounded" > > name="userAdd" nillable="true" type="xsd:string"/> > > </xsd:sequence> > > </xsd:complexType> > > </xsd:schema> > > </types> > > > > <message name="addRequest"> > > <part name="num1" type="xsd:int"/> > > <part name="num2" type="xsd:int"/> > > </message> > > > > <message name="addResponse"> > > <part name="result" type="xsd:int"/> > > </message> > > > > <message name="sayHellToRequest"> > > <part name="name" type="xsd:string"/> > > </message> > > > > <message name="sayHellToResponse"> > > <part name="reply" type="xsd:string"/> > > </message> > > > > <message name="sayHellTo1Request"> > > <part name="names" type="xsd1:ArrayOfString"/> > > </message> > > > > <message name="sayHellTo1Resonse"> > > <part name="reply" type="xsd:string"/> > > </message> > > > > <message name="testUserRequest"> > > <part name="user" type="xsd1:HelloUser"/> > > </message> > > > > <message name="testUserResponse"> > > </message> > > > > <portType name="HelloServer"> > > <operation name="add" parameterOrder="num1 num2"> > > <input message="tns:addRequest" name="addRequest"/> > > <output message="tns:addResponse" > > name="addResponse"/> > > </operation> > > > > <operation name="sayHelloTo"> > > <input message="tns:sayHelloToRequest" > > name="sayHelloToRequest"/> > > <output message="tns:sayHelloToResponse" > > name="sayHelloToResponse"/> > > </operation> > > > > <operation name="sayHelloTo1"> > > <input message="tns:sayHelloTo1Request" > > name="sayHelloTo1Request"/> > > <output message="tns:sayHelloTo1Response" > > name="sayHelloTo1Response"/> > > </operation> > > > > <operation name="testUser"> > > <input message="tns:testUserRequest" > > name="testUserRequest"/> > > <output message="tns:testUserResponse" > > name="testUserResponse"/> > > </operation> > > </portType> > > > > <binding name="HelloServerBinding" type="tns:HelloServer"> > > <soap:binding style="document" > > transport="http://schemas.xmlsoap.org/soap/http"/> > > > > <operation name="add"> > > <soap:operation soapAction=""/> > > <input name="addRequest"> > > <soap:body > > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > </input> > > <output name="addResponse"> > > <soap:body > > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > </output> > > </operation> > > > > <operation name="sayHelloTo"> > > <soap:operation soapAction=""/> > > <input name="sayHelloToRequest"> > > <soap:body > > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > </input> > > <output name="sayHelloToResponse"> > > <soap:body > > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > </output> > > </operation> > > > > <operation name="sayHelloTo1"> > > <soap:operation soapAction=""/> > > <input name="sayHelloTo1Request"> > > <soap:body > > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > </input> > > <output name="sayHelloTo1Response"> > > <soap:body > > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > </output> > > </operation> > > > > <operation name="testUser"> > > <soap:operation soapAction=""/> > > <input name="testUserRequest"> > > <soap:body > > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > </input> > > <output name="testUserResponse"> > > <soap:body > > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > namesapce="http://craft.epfl.ch/wsdl/HelloServer.wsdl" > > use="literal"/> > > </output> > > </operation> > > > > </binding> > > > > <service name="HelloServerService"> > > <port name="HelloServerPort" > > binding="tns:HelloServerBinding"> > > <soap:address > > > location="http//:craftgepc18.epfl.ch:8080/axis/services/helloserver"/>> > </port> > > </service> > > > > </definitions> > > > > > >
HelloServer.wsdl
Description: Binary data
generated.wsdl
Description: Binary data
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.573
//
// 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.573.
//
namespace HelloWorld {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="HelloServerBinding",
Namespace="http://craft.epfl.ch/wsdl/HelloServer.wsdl")]
public class HelloServer : System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public HelloServer() {
this.Url = "http://craftgepc18.epfl.ch:8080/axis/services/HelloServer";
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("HelloServer:HelloServerPortType#add",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
public void
add([System.Xml.Serialization.XmlElementAttribute(Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2")]
ref int intElement, [System.Xml.Serialization.XmlElementAttribute("intElement",
Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2")] int intElement1) {
object[] results = this.Invoke("add", new object[] {
intElement,
intElement1});
intElement = ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult Beginadd(int intElement, int intElement1,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("add", new object[] {
intElement,
intElement1}, callback, asyncState);
}
/// <remarks/>
public void Endadd(System.IAsyncResult asyncResult, out int intElement) {
object[] results = this.EndInvoke(asyncResult);
intElement = ((int)(results[0]));
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("HelloServer:HelloServerPortType#sayHelloTo",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
public void
sayHelloTo([System.Xml.Serialization.XmlElementAttribute(Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2")]
ref string stringElement) {
object[] results = this.Invoke("sayHelloTo", new object[] {
stringElement});
stringElement = ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginsayHelloTo(string stringElement,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("sayHelloTo", new object[] {
stringElement}, callback, asyncState);
}
/// <remarks/>
public void EndsayHelloTo(System.IAsyncResult asyncResult, out string
stringElement) {
object[] results = this.EndInvoke(asyncResult);
stringElement = ((string)(results[0]));
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("HelloServer:HelloServerPortType#testUser",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("stringElement",
Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2")]
public string
testUser([System.Xml.Serialization.XmlElementAttribute(Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2")]
HelloUser HelloUserElement) {
object[] results = this.Invoke("testUser", new object[] {
HelloUserElement});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BegintestUser(HelloUser HelloUserElement,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("testUser", new object[] {
HelloUserElement}, callback, asyncState);
}
/// <remarks/>
public string EndtestUser(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("HelloServer:HelloServerPortType#sayHelloTo1",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("stringElement",
Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2")]
public string
sayHelloTo1([System.Xml.Serialization.XmlArrayAttribute(Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2")]
[System.Xml.Serialization.XmlArrayItemAttribute("names",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified,
Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2", IsNullable=false)] string[]
ArrayOfStringElement) {
object[] results = this.Invoke("sayHelloTo1", new object[] {
ArrayOfStringElement});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginsayHelloTo1(string[] ArrayOfStringElement,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("sayHelloTo1", new object[] {
ArrayOfStringElement}, callback, asyncState);
}
/// <remarks/>
public string EndsayHelloTo1(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://craft.epfl.ch/wsdl/HelloServer.xsd2")]
public class HelloUser {
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public int userID;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string userName;
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("names",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public string[] userAdd;
}
}
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using HelloWorld;
namespace HelloPDA
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.MainMenu mainMenu1;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
string[] names = {"Fabien","Mauro","Nicholas","Merwis"};
HelloServer server = new HelloServer();
string name = "Nitesh";
server.sayHelloTo(ref name);
label1.Text = name;
label2.Text = server.sayHelloTo1(names);
int i=1;
server.add(ref i,2);
label2.Text += i.ToString();
//
// TODO: Add any constructor code after InitializeComponent
call
//
HelloUser user = new HelloUser();
user.userName = "Nitesh";
user.userID = 165618;
user.userAdd = new string[3];
user.userAdd[0] = "CE 1630";
user.userAdd[1] = "CRAFT";
user.userAdd[2] = "EPFL";
server.testUser(user);
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
//
// label1
//
this.label1.Location = new System.Drawing.Point(40, 72);
this.label1.Size = new System.Drawing.Size(160, 48);
this.label1.Text = "label1";
//
// label2
//
this.label2.Location = new System.Drawing.Point(32, 128);
this.label2.Size = new System.Drawing.Size(176, 128);
this.label2.Text = "label2";
//
// Form1
//
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Menu = this.mainMenu1;
this.Text = "Form1";
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
Application.Run(new Form1());
}
}
}
