cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: CXF Apache: null pointer problem with my reponse
Date Tue, 07 Oct 2008 15:48:48 GMT


Most likely, the response message is actually wrong according to the 
schema.   

The request message makes it look like the element form of the schema is 
set to "unqualified".   The "urn:connect" element is qualified properly, 
but the child elements (user, etc...) are not namespace qualified.   

The response message, however, puts all the elements into 
the "urn:ldaplogonwsdl" namespace.   If the schema says that the xml 
should be unqualified, then the message is wrong.  CXF will not know how 
to deserialize it.

Dan



On Tuesday 07 October 2008, vincerix wrote:
> Hello,
>
> I have a big problem with reception of a CXF answer and i'm looking
> for a solution since many days. In my aut-generated classes, i have a
> null pointer.
> I use "apache-cxf-2.1.2". From a wsdl file, with https, i've
> auto-generated many classes with wsdl2java. My application send a
> request to LDAP server with webservice (using https). Communication
> work fine: my request is sent and web service send me a correct
> response. I think my problem is in these auto-generated classes with
> wsdl2java, because at the reception of the response, inside of the
> response class (a bean), the pointer to another class (an other bean),
> is null and my response (in log) is correct and well formed (like in
> util soapUI).
>
> For more information, here is my request xml:
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:urn="urn:ldaplogonwsdl">
>    <soapenv:Header/>
>    <soapenv:Body>
>       <urn:connect>
>          <user>
>             <!--You may enter the following 2 items in any order-->
>             <login>user</login>
>             <pwd>pwd</pwd>
>          </user>
>       </urn:connect>
>    </soapenv:Body>
> </soapenv:Envelope>
>
> Here is my response:
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
>    <SOAP-ENV:Body>
>       <connectResponse xmlns="urn:ldaplogonwsdl">
>          <return>
>             <answer>SUCCESS</answer>
>             <userid>11111</userid>
>             <login>user</login>
>             <nom>name</nom>
>             <prenom>surname</prenom>
>             name@domain.fr
>             <fonction>
>                <code_entite>111</code_entite>
>                <titre>test</titre>
>             </fonction>
>          </return>
>       </connectResponse>
>    </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> Here is the auto-generated code with wsdl2java for response:
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "connectResponseType", propOrder = {
> 		"_return"
> })
>
> public class ConnectResponseType {
>
>     @XmlElement(name = "return", required = true)
>     protected ConnectedUser _return;
>
>     public ConnectedUser getReturn() {
>         return _return;
>     }
>
>     public void setReturn(ConnectedUser value) {
>         this._return = value;
>     }
> }
>
> The "_return" pointer has value null at response time.
>
> Here is my call code:
> URL wsdlURL = new URL("https://adress/ldaplogon?wsdl");
> QName SERVICE_NAME = new QName("urn:ldaplogonwsdl", "ldaplogonwsdl");
> Ldaplogonwsdl ss = new Ldaplogonwsdl(wsdlURL, SERVICE_NAME);
> LdaplogonwsdlPortType port = ss.getLdaplogonwsdlPort();
> org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
> HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
> TLSClientParameters tlsParams = new TLSClientParameters();
> tlsParams.setSecureSocketProtocol("SSL");
> httpConduit.setTlsClientParameters(tlsParams);
> HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
> httpClientPolicy.setConnectionTimeout(36000);
> httpClientPolicy.setAllowChunking(false);
> httpClientPolicy.setReceiveTimeout(32000);
> httpConduit.setClient(httpClientPolicy);
> ConnectRequestType _connect_parameters = new ConnectRequestType();
> User myUser = new User();
> myUser.setLogin(username);
> myUser.setPwd(password);
> _connect_parameters.setUser(myUser);
> ConnectResponseType _connect__return =
> port.connect(_connect_parameters);
> System.out.println("_connect__return=" + _connect__return);
> ConnectedUser connectedUser = (ConnectedUser)
> _connect__return.getReturn();
>
> And connectedUser has value null.
> Please, could you help me?
>
> Thank you in advance,
> Vincent



-- 
J. Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message