Anne,

Thank you very much for your response. It seems that you got it. I tried the first 
changes you suggested for the WSDL file and it worked immediatly. 

I informed the service developer and will let you now of his response if you are 
interested.

Thanks again and regards,
Ulrich

-----Ursprüngliche Nachricht-----
Von: Anne Thomas Manes [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 16. Oktober 2004 15:25
An: [EMAIL PROTECTED]
Betreff: RE: Weird error message when using WSDL2JAVA generated classes

I suspect that the service is expecting a wrapper element called
DocumentGetCollection rather than DocumentGetCollectionRequest, although
that's not what the WSDL indicates. 

Can you ask the service developer to supply you with the WSDD of the service
and a sample SOAP request message from C# that does work?

I suspect that the developer intended to build a "wrapped" style service,
but instead developed a "document" service. To qualify as a "wrapped"
service, the input request element must be the same as the operation name
("DocumentGetCollection" rather then "DocumentGetCollectionRequest"). 

You might also try making the following changes to the WSDL file:

Change the input message definition to:

<message name="DocumentGetCollectionSoapIn">
 <part name="parameter" element="y:DocumentGetCollection"/>
</message>

And add the following to the schema in the types:

<element name="DocumentGetCollection">
  <complexType>
    <sequence>
      <element ref="DocumentGetCollectionRequest"/>
    </sequence>
  </complexType>
</element>

(This change adds a wrapper element called DocumentGetCollection around the
DocuemntGetCollectionRequest element.) 

Or try this:

Change the input message definition to:

<message name="DocumentGetCollectionSoapIn">
 <part name="parameter" element="y:DocumentGetCollection"/>
</message>

And change the name of the DocumentGetCollectionRequest element definition
in the schema to DocuemntGetCollection:

        <xs:element name="DocumentGetCollection">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="OnlyUnread"
                          type="xs:boolean" default="true"/>
                                <xs:element name="OutboxList"
                          type="xs:boolean" default="false"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>

(This second option is how I would expect someone to define a "wrapped"
style service.)

- Anne

-----Original Message-----
From: Ulrich Ackermann [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 15, 2004 5:42 AM
To: [EMAIL PROTECTED]
Subject: Weird error message when using WSDL2JAVA generated classes

Hi all,

I have got a problem using the classes that were generated bei
WSDL2JAVA. As far as I can see, the wsdl document that I got offered
looks quite fine.

That wsdl document defines an operation 'DocumentGetCollection' which
takes one parameter (DocumentGetCollectionRequest) and returns a
DocumentGetCollectionResponse object.

So far so good, but when I try to invoke that method I get the following
error message: 
AxisFault
 faultCode: Server
 faultSubcode: 
 faultString: method &apos;DocumentGetCollectionRequest&apos; not
defined in service
 faultActor: 
 faultNode: 
 faultDetail: 
        {}soapVal: null

method 'DocumentGetCollectionRequest' not defined in service
        at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.ja
va:260)
        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.jav
a:169)
        at
org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseriali
zationContextImpl.java:1015)
        at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1675)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
        at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
        at
org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializatio
nContextImpl.java:242)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
        at org.apache.axis.client.Call.invoke(Call.java:2553)
        at org.apache.axis.client.Call.invoke(Call.java:2248)
        at org.apache.axis.client.Call.invoke(Call.java:2171)
        at org.apache.axis.client.Call.invoke(Call.java:1691)
        at
SoapBindingStub.documentGetCollection(SoapBindingStub.java:365)
        at client.TestClient.main(TestClient.java:29)


The statement that is given in the faultString line is driving me a bit
crazy. Of course it is perfectly right, that there is no such method
'DocumentGetCollectionRequest'. But I was never invoking such a thing!

BTW: The server side seems to work. I contacted the developer of that
service and he said that he had no problems with his generated C#
client.

The client code that caused this error looks like this:
*snip*
26: _DocumentGetCollectionRequest docReq = new
_DocumentGetCollectionRequest();
27: docReq.setOnlyUnread(true);
28: docReq.setOutboxList(true);
29: _DocumentGetCollectionResponse docResp =
stub.documentGetCollection(docReq);
*snip*

The method in the generated stub goes like this:
Public _DocumentGetCollectionResponse
documentGetCollection(_DocumentGetCollectionRequest parameter) throws
java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[0]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("urn:#DocumentGetCollection");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
Boolean.FALSE);
 
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS
);
        _call.setOperationName(new javax.xml.namespace.QName("",
"DocumentGetCollection"));

        setRequestHeaders(_call);
        setAttachments(_call);
        java.lang.Object _resp = _call.invoke(new java.lang.Object[]
{parameter});

        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (_DocumentGetCollectionResponse) _resp;
            } catch (java.lang.Exception _exception) {
                return (_DocumentGetCollectionResponse)
org.apache.axis.utils.JavaUtils.convert(_resp,_DocumentGetCollectionResp
onse.class);
            }
        }
    }

And the important lines in the wsdl document are as follows:

*snip*

<!--== Operation DocumentGetCollection-->
        <xs:element name="DocumentGetCollectionRequest">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="OnlyUnread"
type="xs:boolean" default="true"/>
                                <xs:element name="OutboxList"
type="xs:boolean" default="false"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
        <xs:element name="DocumentGetCollectionResponse">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="Document"
type="y:Document" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>

*snip*

        <message name="DocumentGetCollectionSoapIn">
                <part name="parameter"
element="y:DocumentGetCollectionRequest"/>
        </message>
        <message name="DocumentGetCollectionSoapOut">
                <part name="parameter"
element="y:DocumentGetCollectionResponse"/>
        </message>

*snip*

        <operation name="DocumentGetCollection">
                <input message="y:DocumentGetCollectionSoapIn"/>
                <output message="y:DocumentGetCollectionSoapOut"/>
        </operation>

        <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="DocumentGetCollection">
                <soap:operation
soapAction="urn:#DocumentGetCollection"/>
                <input>
                        <soap:body use="literal"/>
                </input>
                <output>
                        <soap:body use="literal"/>
                </output>
        </operation>

*snip*

        <service name=" strictly confidental service name...">
                <port name="SoapPort" binding="y:SoapBinding">
                        <soap:address location="strictly confidental
URL..."/>
                </port>
        </service>



Reply via email to