Hi guys!

I've deployed a cool Service Assembly into ServiceMix, and I tested it. It
works, as I can see in ServiceMix console.

So, I decided to create a Java Client with NetBeans. As always, my code is:

Java Client Code for my service
public static void main(String[] args) {
        // TODO code application logic here
        try { // Call Web Service Operation
            es.ugr.smclient.AutentificaService service = new
es.ugr.smclient.AutentificaService();
            es.ugr.smclient.AutentificaPortType port =
service.getAutentificaPort();
            // TODO initialize WS operation arguments here
            java.lang.String user = "myself";
            java.lang.String pass = "sesame";
            javax.xml.ws.Holder<java.lang.String> ticket = new
javax.xml.ws.Holder<java.lang.String>();
            javax.xml.ws.Holder<java.lang.String> cookieLiferay = new
javax.xml.ws.Holder<java.lang.String>();
            port.autentificaOperation(user, pass, ticket, cookieLiferay);
            System.out.println("DONE");
            System.out.println("TICKET = "+ticket.value);
            System.out.println("COOKIE = "+cookieLiferay.value);
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }
    }
End of Java Client Code for my service

But the ticket.value and cookieLiferay.value is null!... besides the SOAP
response is:

ServiceMix Soap Response for my service
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
<soapenv:Body>
<AutentificaOperationResponse
xmlns="http://j2ee.netbeans.org/wsdl/Autentifica";
xmlns:ns1="http://j2ee.netbeans.org/wsdl/Autentifica";>
        <ticket>ticket-2-bZgxuzspAbxRv1ftePnIHOabxlIScNtsUyV</ticket>
        <cookieLiferay>93853E91654012DC4BCD2A4CD630AACF</cookieLiferay>
</AutentificaOperationResponse>
</soapenv:Body>
</soapenv:Envelope>
End of ServiceMix Soap Response for my service

What's wrong in my java source?

But... wait a moment. I've created another Java client for the wsdl-first
example

Java Client for PersonService
public static void main(String[] args) {
        // TODO code application logic here
        try { // Call Web Service Operation
            personserviceclient.PersonService service = new
personserviceclient.PersonService();
            personserviceclient.Person port = service.getSoap();
            // TODO initialize WS operation arguments here
            System.out.println("HOLA");
            javax.xml.ws.Holder<java.lang.String> personId = new
javax.xml.ws.Holder<java.lang.String>();
            personId.value="world";
            javax.xml.ws.Holder<java.lang.String> ssn = new
javax.xml.ws.Holder<java.lang.String>();
            javax.xml.ws.Holder<java.lang.String> name = new
javax.xml.ws.Holder<java.lang.String>();
            port.getPerson(personId, ssn, name);
            
            System.out.println("A VER");
            System.out.println("PErson ID "+personId.value);
            System.out.println("ssn "+ssn.value);
            System.out.println("name "+name.value);
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }
    }
End of Java Client for Person service

It's quite similar to the source above. But this client works!

The soap response of the Person service is:
Person Service SOAP
<?xml version='1.0' encoding='UTF-8'?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";>
<env:Body>
        <GetPersonResponse
xmlns="http://servicemix.apache.org/samples/wsdl-first/types";>
                <personId>world</personId>
                <ssn>000-000-0000</ssn>
                <name>Guillaume</name>
        </GetPersonResponse>
</env:Body>
</env:Envelope>
End Of Person Service SOAP

It's practically equal to my service soap response :/

So... we have very simillar soap responses and java client sources. The
Person Service client works. Mine not. Why?
 
Or... Do you know any tutorial to start again to develop a new java client?
-- 
View this message in context: 
http://www.nabble.com/How-to-create-a-Java-client--%28two-simillar-clients-have-different-behaviour%29-tf3369156s12049.html#a9374261
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to