Solved

Invoking a web service

Posted on 2010-09-12
48
3,435 Views
Last Modified: 2013-12-14
Main method creating perfect xml for the invoke of webservice ;
but it is not invoking the web service how could i call and get the result from webservice


This is the answer of given code :


run:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:login xmlns:ns2="http://ws.dgpys.deloitte.com">
    <ns3:Test xmlns:ns3="http://tempuri.org">
        <ns3:Test v="example"/>
        <ns3:Test v="example"/>
    </ns3:Test>
</ns2:login>
BUILD SUCCESSFUL (total time: 1 second)
public void callAsyncCallback(){

    try { // Call Web Service Operation(async. callback)

       PmumService.Login cr = new PmumService.Login();

       cr.setLoginMessage(  new Main().Mesaj());

      // TODO initialize WS operation arguments here

      javax.xml.ws.AsyncHandler<PmumService.Login> asyncHandler =

              new javax.xml.ws.AsyncHandler<PmumService.Login>() {

            public void handleResponse(javax.xml.ws.Response<PmumService.Login> response) {

                  try {

                        // TODO process asynchronous response here

                        System.out.println("Result = "+ response.get());

                  } catch(Exception ex) {

                        System.out.println(ex.toString());

                  }

            }

      };

      } catch (Exception ex) {

                        System.out.println(ex.toString());

}

}





    public static void main(String[] args) {

            PmumService.Login cr = new PmumService.Login();

            cr.setLoginMessage(  new Main().Mesaj());

            new Main().callAsyncCallback();

            try

            {

                javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(cr.getClass().getPackage().getName());

                javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller();

                marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); //NOI18N

                marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

                marshaller.marshal(cr, System.out);

            } 

            catch (javax.xml.bind.JAXBException ex)

            {

                // XXXTODO Handle exception

                java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, null, ex); //NOI18N

            }

    }

Open in new window

0
Comment
Question by:3XLcom
  • 28
  • 18
48 Comments
 

Author Comment

by:3XLcom
ID: 33657200
but  if you check the image if i send wrong credentials i need to get the answer as :

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header><wsa:ReplyTo><wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address><wsa:ReferenceParameters><axis2:ServiceGroupId xmlns:axis2="http://ws.apache.org/namespaces/axis2">urn:uuid:D103FAD43998C378311284309692319</axis2:ServiceGroupId></wsa:ReferenceParameters></wsa:ReplyTo></soapenv:Header><soapenv:Body><LoginReport><Code v="-1"/><Text v="Authorization error!"/></LoginReport></soapenv:Body></soapenv:Envelope>

but i am getting nothing this is the code that i use

public void callAsyncCallback(){

    try { // Call Web Service Operation(async. callback)

       PmumService.Login cr = new PmumService.Login();

       cr.setLoginMessage(  new Main().Mesaj());

      // TODO initialize WS operation arguments here

      javax.xml.ws.AsyncHandler<PmumService.Login> asyncHandler =

              new javax.xml.ws.AsyncHandler<PmumService.Login>() {

            public void handleResponse(javax.xml.ws.Response<PmumService.Login> response) {

                  try {

                        // TODO process asynchronous response here

                        System.out.println("Result = "+ response.get());

                  } catch(Exception ex) {

                        System.out.println(ex.toString());

                  }

            }

      };

      } catch (Exception ex) {

                        System.out.println(ex.toString());

}

}

    public static void main(String[] args) {

            PmumService.Login cr = new PmumService.Login();

            cr.setLoginMessage(  new Main().Mesaj());

            new Main().callAsyncCallback();

            try

            {

                javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(cr.getClass().getPackage().getName());

                javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller();

                marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); //NOI18N

                marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

                marshaller.marshal(cr, System.out);

            } 

            catch (javax.xml.bind.JAXBException ex)

            {

                // XXXTODO Handle exception

                java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, null, ex); //NOI18N

            }

    }



}

Open in new window

scr.png
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33657227
I tried calling the service like this, but generates the original error you get ... seeing if I see what is wrong.
public static void main(String[] args) {

    Main m = new Main();

    Holder<IntValue> code = null;

    Holder<StringValue> text = null;



    try {

        EVDServis service = new EVDServis();

        LoginMessage msg = new LoginMessage();

        StringValue sv = new StringValue();

        sv.setV("example");

        msg.setPassword(new JAXBElement<StringValue>(service.getServiceName(), StringValue.class, sv));

        msg.setUserName(new JAXBElement<StringValue>(service.getServiceName(), StringValue.class, sv));

        service.getEVDServisSOAP11PortHttp().login(msg, code, text);

    } catch (Exception e) {

        System.out.println(e.getMessage());

    }



    System.out.println("code: " + code + "; text: " + text);

}

Open in new window

0
 

Author Comment

by:3XLcom
ID: 33657248
I appreciate for all your help
this time it does not like :
EVDServis service = new EVDServis();
i tryed as this also
PmumService.EVDServis service = new PmumService.EVDServis();
error.png
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33657271
It should be whatever the class name you gave the EVDServis when generated from the WSDL.  If it is named default, then you probably just need the imports.  You can click on Source --> Fix Imports.
0
 

Author Comment

by:3XLcom
ID: 33657282
no way  :( :'(  
pufff :(
0
 

Author Comment

by:3XLcom
ID: 33657291
I have added the service directly as a webservice client this time i get really bad error messages :D


init:
Deleting: C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\build\built-jar.properties
wsimport-init:
wsimport-client-EVDServis:
files are up to date
wsimport-client-generate:
Compiling 1 source file to C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\build\classes
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:21: cannot find symbol
symbol  : class IntValue
location: class javaapplication6.Main
    Holder<IntValue> code = null;
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:22: java.lang.StringValue is not public in java.lang; cannot be accessed from outside package
    Holder<StringValue> text = null;
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:24: cannot find symbol
symbol  : class EVDServis
location: class javaapplication6.Main
        EVDServis service = new EVDServis();
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:24: cannot find symbol
symbol  : class EVDServis
location: class javaapplication6.Main
        EVDServis service = new EVDServis();
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:25: cannot find symbol
symbol  : class LoginMessage
location: package javaapplication6
        javaapplication6.LoginMessage msg = new javaapplication6.LoginMessage();
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:25: cannot find symbol
symbol  : class LoginMessage
location: package javaapplication6
        javaapplication6.LoginMessage msg = new javaapplication6.LoginMessage();
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:26: java.lang.StringValue is not public in java.lang; cannot be accessed from outside package
        StringValue sv = new StringValue();
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:26: java.lang.StringValue is not public in java.lang; cannot be accessed from outside package
        StringValue sv = new StringValue();
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:28: java.lang.StringValue is not public in java.lang; cannot be accessed from outside package
        msg.setPassword(new JAXBElement<StringValue>(service.getServiceName(), StringValue.class, sv));
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:28: java.lang.StringValue is not public in java.lang; cannot be accessed from outside package
        msg.setPassword(new JAXBElement<StringValue>(service.getServiceName(), StringValue.class, sv));
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:29: java.lang.StringValue is not public in java.lang; cannot be accessed from outside package
        msg.setUserName(new JAXBElement<StringValue>(service.getServiceName(), StringValue.class, sv));
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\src\javaapplication6\Main.java:29: java.lang.StringValue is not public in java.lang; cannot be accessed from outside package
        msg.setUserName(new JAXBElement<StringValue>(service.getServiceName(), StringValue.class, sv));
12 errors
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\nbproject\build-impl.xml:552: The following error occurred while executing this line:
C:\Users\Cahit\Documents\NetBeansProjects\JavaApplication6\nbproject\build-impl.xml:262: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
0
 

Author Comment

by:3XLcom
ID: 33657301
I am nearly out of mind there is sth. really wrong this is my code given below and this is what i get as an answr

run-single:
unexpected XML tag. expected: {http://ws.dgpys.deloitte.com}LoginReport but found: {null}LoginReport
code: null; text: null
BUILD SUCCESSFUL (total time: 4 seconds)

public static void main(String[] args) {

    Main m = new Main();

    Holder<javaapplication6.IntValue> code = null;

    Holder<javaapplication6.StringValue> text = null;

    try {

        EVDServis service = new EVDServis();

        javaapplication6.LoginMessage msg = new javaapplication6.LoginMessage();

        javaapplication6.StringValue sv = new javaapplication6.StringValue();

        sv.setV("example");

        msg.setPassword(new JAXBElement<javaapplication6.StringValue>(service.getServiceName(), javaapplication6.StringValue.class, sv));

        msg.setUserName(new JAXBElement<javaapplication6.StringValue>(service.getServiceName(), javaapplication6.StringValue.class, sv));

        service.getEVDServisSOAP11PortHttp().login(msg, code, text);

    } catch (Exception e) {

        System.out.println(e.getMessage());

    }



    System.out.println("code: " + code + "; text: " + text);

}

Open in new window

0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33657372
Exactly.  It is same error as before.  I am really thinking it is not returning XML we suspect when invalid credentials are passed, but was seeing if I could figure it out before posting back.  Have another thought I need to test ... so please be patient.
0
 

Author Comment

by:3XLcom
ID: 33657379
but when i use stylus studio 2010 i got the right answer i need to get this as an answer :



<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header><wsa:ReplyTo><wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address><wsa:ReferenceParameters><axis2:ServiceGroupId xmlns:axis2="http://ws.apache.org/namespaces/axis2">urn:uuid:D103FAD43998C378311284309692319</axis2:ServiceGroupId></wsa:ReferenceParameters></wsa:ReplyTo></soapenv:Header><soapenv:Body><LoginReport><Code v="-1"/><Text v="Authorization error!"/></LoginReport></soapenv:Body></soapenv:Envelope>


This is the right answer that i got from this test software
and this is very different from what we get
0
 

Author Comment

by:3XLcom
ID: 33657383
how we could write the answer xml to the output to see what is going on exactly ?
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33657554
I was going to use the Dispatch code method, but I have been getting connection issues ... maybe try from your end.
public class EVDServisClient {



    public static void main(String[] args) {

        EVDServis service = new EVDServis();



        QName portQName = new QName("http://ws.deloitte.com", "EVDServisSOAP11port_http");

        String req = "<login  xmlns=\"http://ws.deloitte.com\"><loginMessage><Password v=\"deneme\"/><UserName v=\"deneme\"/></loginMessage></login>";



        try { // Call Web Service Operation



            Dispatch<Source> sourceDispatch = null;

            sourceDispatch = service.createDispatch(portQName, Source.class, Service.Mode.PAYLOAD);

            Source result = sourceDispatch.invoke(new StreamSource(new StringReader(req)));

        } catch (Exception ex) {

            // TODO handle custom exceptions here

        }

    }

}

Open in new window

0
 

Author Comment

by:3XLcom
ID: 33657580
Service.Mode giving error for me :(
0
 

Author Comment

by:3XLcom
ID: 33657677
I resolved it but it generated this error :


javax.xml.ws.WebServiceException: {http://ws.deloitte.com}EVDServisSOAP12port_http is not a valid port. Valid ports are: {http://ws.dgpys.deloitte.com}EVDServisSOAP12port_http,{http://ws.dgpys.deloitte.com}EVDServisSOAP11port_http

BUILD SUCCESSFUL (total time: 1 second)

What a silly error :D we already writing what it suggest :D
0
 

Author Comment

by:3XLcom
ID: 33657753
I reorgonized some codes and it worked perfect as this but i could not read the result


   public static void main(String[] args) {

        EVDServis service = new EVDServis();



        QName portQName = new QName("http://ws.dgpys.deloitte.com", "EVDServisSOAP11port_http");

        String req = "<Envelope  xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\"><Body><login xmlns=\"http://ws.dgpys.deloitte.com\"><loginMessage><Password v=\"deneme\"/><UserName v=\"deneme\"/></loginMessage></login></Body></Envelope>";



        try { // Call Web Service Operation

            Dispatch<Source> sourceDispatch = null;

            sourceDispatch = service.createDispatch(portQName, Source.class, javax.xml.ws.Service.Mode.MESSAGE );

            Source result = sourceDispatch.invoke(new StreamSource(new StringReader(req)));

            





        } catch (WebServiceException wse){

	wse.printStackTrace();

        }

    }

Open in new window

0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33657977
Yes, it was weird the Dispatch code was generated by Netbeans with the wrong namespace.
0
 

Author Comment

by:3XLcom
ID: 33658003
This is where i am at the end and this is result :

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: The endpoint reference (EPR) for the Operation not found is http://dgpys.teias.gov.tr/dgpys/services/EVDServis and the WSA Action =


the same writing with :

http://http://dgpys.teias.gov.tr/dgpys/services/EVDServis

:(
               EVDServis service = new EVDServis();



        QName portQName = new QName("http://ws.dgpys.deloitte.com", "EVDServisSOAP11port_http");

        String req = "<Envelope  xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\"><Body><login xmlns=\"http://ws.dgpys.deloitte.com\"><loginMessage><Password v=\"deneme\"/><UserName v=\"deneme\"/></loginMessage></login></Body></Envelope>";



        try { // Call Web Service Operation

            Dispatch<Source> sourceDispatch  = service.createDispatch(portQName, Source.class, javax.xml.ws.Service.Mode.MESSAGE );

            Source result = sourceDispatch.invoke(new StreamSource(new StringReader(req)));

            Result streamResult = new StreamResult(System.out);

            System.out.println("*********result*********");

            TransformerFactory.newInstance().newTransformer().transform(result, streamResult);



        } catch (Exception ex){

	System.out.print(ex.toString());

        }

Open in new window

0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33658083
I don't get an exception, but I don't get any result either.  I am probably missing something here, so if you don't get other input I would contact a moderator using the Request Attention to attract other Experts who may spot something different.
0
 

Author Comment

by:3XLcom
ID: 33658111
When i change PAYLOAD to MESSAGE also i am not getting any error :) but i do not get a result too.
I do not understand how or why :S
0
 

Author Comment

by:3XLcom
ID: 33669201
emergency and something very strange at the end of our talking with Mwvisa ,Stylus Studio 2010 XML EnterPrise suite is able to get response from web service
Our web service address is :
http://dgpys.teias.gov.tr/dgpys/services/EVDServis?wsdl
and after adding this there is only one thing to do change endpoint addresses to this :

  <wsdl:service name="EVDServis">
    <wsdl:port name="EVDServisSOAP11port_http" binding="dgp:EVDServisSOAP11Binding">
      <soap:address location="http://dgpys.teias.gov.tr/dgpys/services/EVDServis"/>
    </wsdl:port>
    <wsdl:port name="EVDServisSOAP12port_http" binding="dgp:EVDServisSOAP12Binding">
      <soap12:address location="http://dgpys.teias.gov.tr/dgpys/services/EVDServis"/>
    </wsdl:port>
  </wsdl:service>

and then as i said stylus studio able to get an answer when we send this request :
<?xml version="1.0"?>
<Envelope  xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<login xmlns="http://ws.dgpys.deloitte.com">
<loginMessage>
<Password v="deneme"/>
<UserName v="deneme"/>
</loginMessage>
</login>
</Body>
</Envelope>
and the result is :

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header><wsa:ReplyTo><wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address><wsa:ReferenceParameters><axis2:ServiceGroupId xmlns:axis2="http://ws.apache.org/namespaces/axis2">urn:uuid:D103FAD43998C378311284324782782</axis2:ServiceGroupId></wsa:ReferenceParameters></wsa:ReplyTo></soapenv:Header><soapenv:Body><LoginReport><Code v="-1"/><Text v="Authorization error!"/></LoginReport></soapenv:Body></soapenv:Envelope>

but we could not succedd


Please helpppp
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33670610
Hopefully you get some other help, but even the stylus studio is returning LoginReport without the expected namespace which is the exception we are getting.  I would contact the owner of service and make sure using right approach (i.e., should you use jax-rpc for example) ... as I said, I compiled a proxy class in Eclipse just fine using Axis2, which you can add support for in Netbeans, but I would have them give you details or find another company utilizing and see if they know of the know bug in xml being different than the wsdl specifies with regard to the namespace.
0
 

Author Comment

by:3XLcom
ID: 33670735
But i should think that if this program was fail for this :
Stylus Studio 2010 XML Enterprise Suite
but it gets the right answer without any modification unfortunately
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33671195
The stylus studio is just returning you the XML whereas the client generated is trying to adhere *strictly* (or literally) to the XML required as defined by the WSDL.  If you look at the login method stub you will see that it specifically states that the output will be LoginReport with specific namespace.  Therefore, this approach may not be the best.  You may need to for example, create an XML request that conforms to the required form specified by the SOAP example and post to the web service and simply read the response XML yourself.  

Again, if you use JAX-RPC or Axis2 style, you may even see different results.

To take the ambiguity out of it, I would just ask the provider of the service since you have a relationship with them.  If you cannot, then you will have to figure out which approach works best with this service through trial and error.  Being across the pond, I suspect some of the difficulties I have in connections at times are related to that -- the Eclipse method seemed like it was going to work, but got connection timeout so couldn't verify.
0
 

Author Comment

by:3XLcom
ID: 33687052
I tryed with the true login information on stlyus xml studio it returned a successfully connection info ; then i tryed on our code but got the same result. So we need to what this trial program do.

"The stylus studio is just returning you the XML whereas the client generated is trying to adhere *strictly* (or literally) to the XML required as defined by the WSDL.  If you look at the login method stub you will see that it specifically states that the output will be LoginReport with specific namespace.  Therefore, this approach may not be the best.  You may need to for example, create an XML request that conforms to the required form specified by the SOAP example and post to the web service and simply read the response XML yourself.  "

From this part of your answer, if we could do it maybe we will be able to go to next step but i can not figure out what is our problem with the web service connection. I am nearly getting crazy :(

0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33696257
Okay, sorry for the delay.  Guess I have too many things going on that I didn't remember I had recently had to reload this entire machine ; therefore, Axis2 was not configured properly in my Eclipse, so I had tried with Axis previously.  At any rate, once I got Axis2 configured I generated client from WSDL in Eclipse and tested the following request via SOAP11Binding :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:q0="http://ws.dgpys.deloitte.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
   
     
         
         
     
   
  </soapenv:Body>
  </soapenv:Envelope>

Then I successfully got this results:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:wsa="http://www.w3.org/2005/08/addressing">
   <soapenv:Header>
   
      http://www.w3.org/2005/08/addressing/none
     
      urn:uuid:AA1FA3E19A8DDF41DA1284666789668
       
   
  </soapenv:Header>
  <soapenv:Body>
 
 

Open in new window


   
 
  </soapenv:Body>
  </soapenv:Envelope>

Noticed that LoginReport doesn't have a namespace defined which is consistent with the error message you are getting.  For Axis2 client deployment, a couple things I tried which may have helped this to work:

+I included the port number in the service location even though it is default port 80 as that has been known to work and noticed they were doing so originally with the IP address we replaced.


      <soap:address location="http://dgpys.teias.gov.tr:80/dgpys/services/EVDServis"/>
   

+I had data binding off, but that was because I had a problem with something ... I went back and ran it again just now with ADB and worked the same, so most likely the port as without that I was getting an unknown server error.

At any rate, I got this to work and have verified the XML returned doesn't have a LoginReport node with a namespace ; therefore, the JAXB error is valid since a namespace is expected per the definition.  I have seen this documented as fixable using SAX Filter , so you can search around Sun site for example.

Guess I don't use JAXB enough given I tend to just use Axis2 and Eclipse as it appears this is a known issue going way back in Sun forum, so you can search around for unmarshalling JAXB without namespace if you want to research that more otherwise I would suggest using Axis2 client to connect with this service as that appears to work just fine.
0
 

Author Comment

by:3XLcom
ID: 33698951
This is perfect i will try it to tomorrow now i am out of my city. But that is all i need to do already if this works on my pc too god bless you :)
0
 

Author Comment

by:3XLcom
ID: 33698980
Should i want 2 things :)
1- Should you share the code with me
2- I looked but i could not find how to connect to Axis2 Web Services

Thank you
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33700389
Here you go: https://filedb.experts-exchange.com/incoming/ee-stuff/7999-dgpys.zip

p.s., I just realized that you had posted a Resource Adapter Archive, previously.  With Eclipse now installed, I probably could have read that file -- oh well...
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33700431
Nevermind, it would appear that it was as I thought a .RAR zip format and Eclipse couldn't open it.  Anyway, good luck.
0
 

Author Comment

by:3XLcom
ID: 33701274
I will check it out today. Thank you very much i think i will succeed on this way....
Thank you for all your help
0
 

Author Comment

by:3XLcom
ID: 33705698
I am sorry mwvisa1 but it returns me for login method that you send the code :

Result
exception: unknown

for correct and non correct tryings and eclipse generate no error for application
0
 

Author Comment

by:3XLcom
ID: 33705731
Actually when i remove the try catch part it shows :

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /Result.jsp at line 112

109:         <jsp:useBean id="com1deloitte1dgpys1ws1holders1StringValueHolder_9id" scope="session" class="com.deloitte.dgpys.ws.holders.StringValueHolder" />
110:         <%
111:         com1deloitte1dgpys1ws1holders1StringValueHolder_9id.value = com1deloitte1dgpys1ws1StringValue_10id;
112:         sampleEVDServisPortTypeProxyid.login(com1deloitte1dgpys1ws1LoginMessage_1id,com1deloitte1dgpys1ws1holders1IntValueHolder_6id,com1deloitte1dgpys1ws1holders1StringValueHolder_9id);
113: break;
114: }
115:


Stacktrace:
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:407)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33705858
Not sure why you are getting that.  If you have Eclipse configured with Axis2, then you are probably better off re-running the Generate Client wizard and test again.  Probably missed some configuration of project by just copying files.
0
 

Author Comment

by:3XLcom
ID: 33705891
I use the complete your code but error is strange check this out
org.apache.jasper.JasperException: An exception occurred processing JSP page /Result.jsp at line 112



109:         <jsp:useBean id="com1deloitte1dgpys1ws1holders1StringValueHolder_9id" scope="session" class="com.deloitte.dgpys.ws.holders.StringValueHolder" />

110:         <%

111:         com1deloitte1dgpys1ws1holders1StringValueHolder_9id.value = com1deloitte1dgpys1ws1StringValue_10id;

112:         sampleEVDServisPortTypeProxyid.login(com1deloitte1dgpys1ws1LoginMessage_1id,com1deloitte1dgpys1ws1holders1IntValueHolder_6id,com1deloitte1dgpys1ws1holders1StringValueHolder_9id);

113: break;

114: }

115: 





Stacktrace:

	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)

	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:407)

	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)

	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)





root cause 



unknown

	org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)

	org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)

	org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)

	com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)

	com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)

	com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)

	com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)

	com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)

	com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

	com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

	com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

	com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)

	com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)

	com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)

	javax.xml.parsers.SAXParser.parse(Unknown Source)

	org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)

	org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)

	org.apache.axis.Message.getSOAPEnvelope(Message.java:435)

	org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)

	org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)

	org.apache.axis.client.Call.invokeEngine(Call.java:2784)

	org.apache.axis.client.Call.invoke(Call.java:2767)

	org.apache.axis.client.Call.invoke(Call.java:2443)

	org.apache.axis.client.Call.invoke(Call.java:2366)

	org.apache.axis.client.Call.invoke(Call.java:1812)

	com.deloitte.dgpys.ws.EVDServisSOAP11BindingStub.login(EVDServisSOAP11BindingStub.java:696)

	com.deloitte.dgpys.ws.EVDServisPortTypeProxy.login(EVDServisPortTypeProxy.java:50)

	org.apache.jsp.Result_jsp._jspService(Result_jsp.java:266)

	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)

	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)

	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

	javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 

Open in new window

erf.png
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33705916
Here are some tutorials on generating webservice client via Eclipse:

http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/WebServiceClient/WebServiceClient.html
http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html

You should be able to reproduce the quick code I used to test, but it will ensure that all the project configuration and references to Axis2 are included correctly.  As I said before, I simply used the Generate Client to test what the XML was coming back as for you; therefore, none of the code was custom and so is just a matter of generating within your Eclipse as I suspect there is web project configuration that didn't transfer with the files I sent above.
0
 

Author Comment

by:3XLcom
ID: 33705929
I was lookng all they to this :
http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html
there is only one difference between us i have no window after adding web service address like given on image
c2-b.png
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33706008
When you first launch the Generate Client screen, you should see the screen with the bar you can lower or raise to determine how much to do -- push this all the way to test client by the way -- on the right you will see three links that say server, Axis, and project name:
http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/images/c2_a.png

Click on the middle one and you should see the screen above where you can select the axis version and server.
0
 

Author Comment

by:3XLcom
ID: 33707009
I look so deeply yesterday when i create web servie client under Axis2 properties it did not generate a code com.deloitte.dgpys.ws.EVDServisPortTypeProxy sth. like this and all your jsp codes are includes this class when i build web service client with axis properties it generate this class so i could not understand how this happens
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33707573
Thing those were from the Axis test I ran.  With Axis2, I used the Web Services Explorer in Eclipse to test.
0
 

Author Comment

by:3XLcom
ID: 33707584
yes now i am also succedd from calling web service explorer with axis2 client but still could not make the same on the program it always generate very strange errors
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33707593
Did you convert the program to use Axis2 generated stubs/proxy OR looked at unmarshalling JAXB without namespaces to get that resolved ? If you are still using the same JAXB code that expects LoginReport to have a namespace and JAXB unmarshalling is set to strictly adhere to this, then you will continue to have the issues.
0
 

Author Comment

by:3XLcom
ID: 33707608
I convert it to axis 2 but i change on the wsdl firstly errors and install it to my ftp and eclipse download it from my source :
http://test.3xlhost.com/dgpys.teias.gov.tr.wsdl

then web service explorer is working now. But i am stiill not able to connect because this time jsp pages does not accept this part :


<jsp:useBean id="sampleEVDServisPortTypeProxyid" scope="session" class="com.deloitte.dgpys.ws.EVDServisPortTypeProxy" /> on the lines like this it does not accept :

com.deloitte.dgpys.ws.EVDServisPortTypeProxy

errrr.png
0
 

Author Comment

by:3XLcom
ID: 33707640
I realize that when i use stub it seems ok but when i use proxy it gives lots of error so how should i connect with stub :D
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 33707694
Why are you using the JSP pages ?
Did the Generate Client recreate those.  I think that got bundled in what I gave you because I ran multiple tests for you to see if plain Axis would work -- I should have given you all my test results I guess.  What I found with plain Axis and the JSP pages was that the service generated too many methods and the Result.jsp size generated was too big.  To test, I only selected the top 4 methods which is getEnpoint ... login.  However, I was getting the unknown server error you were getting until I changed to Axis2.

If you look at the response as you posted in your new question:
http://www.experts-exchange.com/Programming/Languages/Java/Q_26482534.html

It has axis2 as a namespace.

Which is why my guess and advice is that is that the style of WS call being used in Axis2 is what you will need to use instead of JAXB.  Note for your new question you wrote the .NET clients are having issues...not sure if that is what you meant -- if it is, then having a different issue as we should be using Visual Studio to generate the web service reference/proxy.

At any rate, delete all the classes / code OR start a new project.  Place only the WSDL in that project.  Right-click the WSDL and generate the client.  Once it is working, you can now utilize the code base it created to write your client application.
0
 

Author Comment

by:3XLcom
ID: 33707700
No i also write on rentacoder web site it is the same text for declare that this service is just has one way to connect - java.
We both think the same yes it only use axis2 but i could not develop a code axis2 with stub :( and i have so limited time as you could see i am nearly 24 hour working on this :(
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33707751
Yes.  Sorry I couldn't help more ... day job also.  
0
 

Author Comment

by:3XLcom
ID: 33711046
Hi mwvisa :D again it is me i have solved the problem over the .net with creating my own proxy to call web service but on some servicess i am getting a result as the given on this question :

http://www.experts-exchange.com/Programming/Languages/Java/Q_26483717.html

if you check it out i will be very glad
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This is about my first experience with programming Arduino.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now