[
http://issues.apache.org/jira/browse/AXIS-1793?page=comments#action_58220 ]
Julien Wajsberg commented on AXIS-1793:
---------------------------------------
example of a client :
package axis;
import java.io.IOException;
import java.net.URL;
import javax.xml.rpc.ServiceException;
import javax.xml.soap.SOAPException;
import localhost.myMethod.MyHeader;
import localhost.myMethod.MyPortType;
import localhost.myMethod.MyService;
import localhost.myMethod.MyServiceLocator;
import org.apache.axis.client.Stub;
public class PeoplesoftClient {
public static void main(String[] args) throws IOException,
ServiceException, SOAPException {
MyService service = new MyServiceLocator();
MyPortType client = service.getService(new
URL("http://localhost:8101"));
Stub s = (Stub) client;
s.setHeader("", "MyHeader", new MyHeader("GRA", "GRA"));
/* body */
client.myMethod("G");
}
}
> wsdl2java gives NullPointerException when using unqualified "part" attribute
> in soap:header
> -------------------------------------------------------------------------------------------
>
> Key: AXIS-1793
> URL: http://issues.apache.org/jira/browse/AXIS-1793
> Project: Axis
> Type: Bug
> Components: WSDL processing
> Versions: 1.2RC2
> Environment: Linux 2.6, using the ANT task wsdl2java
> Reporter: Julien Wajsberg
>
> When using the following wsdl, I get a NullPointerException. I traced the bug
> to be cause by an unqualified "part" attribute on the soap:header line.
> WSDL :
> ----
> <?xml version="1.0"?>
> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:wsdl_target="http://localhost/myMethod" name="myMethod"
> targetNamespace="http://localhost/myMethod">
> <wsdl:types>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://localhost/myMethod">
> <xsd:element name="myMethod">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element type="xsd:string" name="str1"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="MyHeader">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="Username" type="xsd:string" maxOccurs="1"
> minOccurs="1"/>
> <xsd:element name="Password" type="xsd:string" maxOccurs="1"
> minOccurs="1"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> </wsdl:types>
> <wsdl:message name="MyMessage">
> <wsdl:part name="parameters" element="wsdl_target:myMethod"/>
> </wsdl:message>
> <wsdl:message name="MyHeaderMessage">
> <wsdl:part name="parameters" element="wsdl_target:MyHeader"/>
> </wsdl:message>
> <wsdl:portType name="MyPortType">
> <wsdl:operation name="myMethod">
> <wsdl:input message="wsdl_target:MyMessage"/>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="MyBinding" type="wsdl_target:MyPortType">
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name="myMethod">
> <soap:operation style="document" soapAction=""/>
> <wsdl:input>
> <soap:body use="literal"/>
> <soap:header use="literal" part="parameters"
> message="wsdl_target:MyHeaderMessage"/>
> </wsdl:input>
> <wsdl:output>
> <soap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="MyService">
> <wsdl:port name="Service" binding="wsdl_target:MyBinding">
> <soap:address location="http://whatever/web/service"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> ----
> If I remove 'part="parameters", or if I add replace it by
> 'part="wsdl_target:parameters"', it works fine.
> I get the following exception :
> ----
> [axis-wsdl2java] java.lang.NullPointerException
> [axis-wsdl2java] at
> org.apache.axis.wsdl.toJava.Utils.getNewQNameWithLastLocalPart(Utils.java:933)
> [axis-wsdl2java] at
> org.apache.axis.wsdl.toJava.JavaStubWriter.writeOperationMap(JavaStubWriter.java:590)
> [axis-wsdl2java] at
> org.apache.axis.wsdl.toJava.JavaStubWriter.writeFileBody(JavaStubWriter.java:169)
> [axis-wsdl2java] at
> org.apache.axis.wsdl.toJava.JavaWriter.generate(JavaWriter.java:130)
> [axis-wsdl2java] at
> org.apache.axis.wsdl.toJava.JavaBindingWriter.generate(JavaBindingWriter.java:147)
> [axis-wsdl2java] at
> org.apache.axis.wsdl.toJava.JavaGeneratorFactory$Writers.generate(JavaGeneratorFactory.java:424)
> [axis-wsdl2java] at org.apache.axis.wsdl.gen.Parser.generate(Parser.java:471)
> [axis-wsdl2java] at org.apache.axis.wsdl.gen.Parser.access$000(Parser.java:44)
> [axis-wsdl2java] at
> org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:357)
> [axis-wsdl2java] at java.lang.Thread.run(Thread.java:534)
> ---
> I don't know how the correct implementation should behave, but it should at
> least throw a checked Exception for the user to know where the actual error
> is.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira