Announcement Announcement Module
Collapse
No announcement yet.
Web Service Implementations using Spring, AXIS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Web Service Implementations using Spring, AXIS

    Has anyone tried to deploy and run SWS "Separation of Concerns in Web Service Implementations" at http://www.onjava.com/lpt/a/6711. There is a sample code using spring and article demonstrates how to use Axis, Spring, and Acegi to implement a secured web service that adheres to the SOA principle.

    I want to make this application running so that I can make this as a basis for the development of my project using SPRING-WS.

    README.TXT says :
    Running the Ant target "deploy" will create a war file in the "dist" directory
    that you can drop into your web container to deploy the example.

    Once the service is deployed, there is a simple client that you can use to test
    it out. Just run the Ant target "test" to run the client.


    I used RAD to run build.xml which generates war file and deployed the war file on websphere server.
    when I run the test client shipped into the distribution, I got the following error.

    Once the war is generated, WSDL was missing so I updated the build.xml to include the wsdl but no luck ....

    Buildfile: C:\RADWorkSpace\spring-ws-onjava\build.xml
    test:
    [java] AxisFault
    [java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    [java] faultSubcode:
    [java] faultString: java.net.ConnectException: Connection refused: connect
    [java] faultActor:
    [java] faultNode:
    [java] faultDetail:
    [java] {http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused: connect
    [java] at java.net.PlainSocketImpl.socketConnect(Native Method)
    [java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:331)
    [java] at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:196)
    [java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:183)
    [java] at java.net.Socket.connect(Socket.java:478)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:85)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:58)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:60)
    [java] at java.lang.reflect.Method.invoke(Method.java:391)
    [java] at org.apache.axis.components.net.DefaultSocketFactor y.create(DefaultSocketFactory.java:153)
    [java] at org.apache.axis.components.net.DefaultSocketFactor y.create(DefaultSocketFactory.java:120)
    [java] at org.apache.axis.transport.http.HTTPSender.getSocke t(HTTPSender.java:191)
    [java] at org.apache.axis.transport.http.HTTPSender.writeToS ocket(HTTPSender.java:404)
    [java] at org.apache.axis.transport.http.HTTPSender.invoke(H TTPSender.java:138)
    [java] at org.apache.axis.strategies.InvocationStrategy.visi t(InvocationStrategy.java:32)
    [java] at org.apache.axis.SimpleChain.doVisiting(SimpleChain .java:118)
    [java] at org.apache.axis.SimpleChain.invoke(SimpleChain.jav a:83)
    [java] at org.apache.axis.client.AxisClient.invoke(AxisClien t.java:165)

  • #2
    Have u given the corresponding Service_Address.?

    Comment


    • #3
      Below is the client program. which I am trying to run and soap address as per the wsdl is given. Any thought ???
      ------------------------------

      public class TestClient {
      public static void main(String[] args) {
      try {
      FundsTransferServiceLocator locator = new FundsTransferServiceLocator();
      locator.setEndpointAddress("FundsTransferService", "http://localhost:8080/axis-spring-proj/services/FundsTransferService");
      FundsTransferServiceSoapBindingStub service = (FundsTransferServiceSoapBindingStub)
      locator.getFundsTransferService();

      FundsTransferRequest transferReq = new FundsTransferRequest();
      transferReq.setAmount(new java.math.BigDecimal(1.00));
      transferReq.setSourceAcctNumber((short)1234);
      transferReq.setTargetRoutingNumber((short)11122233 3);
      transferReq.setTargetAcctNumber((short)5678);

      service.setUsername("testuser");
      service.setPassword("password");

      FundsTransferResponse resp = service.transferFunds(transferReq);

      System.out.println("Done. \nConfirmation code: "
      + resp.getConfirmationCode()
      + "\nDate: " + resp.getTransactionDate().getTime());
      }
      catch (Exception e) {
      e.printStackTrace();
      }
      }
      }

      Comment


      • #4
        you said that you have deployed the app in websphere, so have u configured the listener port for listening to this service.
        8080 is defualt for tomcat , not sure about websphere.
        check the Service_Address in the ServiceLocator, it should be the same address that you should have in ur Testclient.

        Comment


        • #5
          Websphere default http port is 9080. But, this is my SOAP address defined in wsdl.
          May be you are right, I might need to update my wsdl to look like-

          http://localhost:9080/axis-spring-pr...ransferService from
          http://localhost:8080/axis-spring-pr...ransferService

          Let me make a try, I will let you know.

          Thanks

          Comment


          • #6
            I tried to change the port to 9080 for websphere and this time I am getting this error.

            Buildfile: C:\RADWorkSpace\spring-ws-onjava\build.xml
            test:
            [java] AxisFault
            [java] faultCode: {http://xml.apache.org/axis/}HTTP
            [java] faultSubcode:
            [java] faultString: (404)Not Found
            [java] faultActor:
            [java] faultNode:
            [java] faultDetail:
            [java] {}:return code: 404
            [java] Error 404: No target servlet configured for uri: /axis-spring-proj/services/FundsTransferService
            [java] {http://xml.apache.org/axis/}HttpErrorCode:404
            [java] (404)Not Found
            [java] at org.apache.axis.transport.http.HTTPSender.readFrom Socket(HTTPSender.java:744)
            [java] at org.apache.axis.transport.http.HTTPSender.invoke(H TTPSender.java:144)
            [java] at org.apache.axis.strategies.InvocationStrategy.visi t(InvocationStrategy.java:32)
            [java] at org.apache.axis.SimpleChain.doVisiting(SimpleChain .java:118)
            [java] at org.apache.axis.SimpleChain.invoke(SimpleChain.jav a:83)
            [java] at org.apache.axis.client.AxisClient.invoke(AxisClien t.java:165)
            [java] at org.apache.axis.client.Call.invokeEngine(Call.java :2784)
            [java] at org.apache.axis.client.Call.invoke(Call.java:2767)
            [java] at org.apache.axis.client.Call.invoke(Call.java:2443)
            [java] at org.apache.axis.client.Call.invoke(Call.java:2366)
            [java] at org.apache.axis.client.Call.invoke(Call.java:1812)
            [java] at com.mybank.service.FundsTransferServiceSoapBinding Stub.transferFunds(Unknown Source)
            [java] at test.TestClient.main(Unknown Source)
            BUILD SUCCESSFUL
            Total time: 3 seconds


            I also updated my wsdl to point to 9080 from 8080. even, I tried to launch wsdl from browser but it did not help, same error.

            http://localhost:9080/axis-spring-pr...erService?wsdl

            Comment


            • #7
              response code (404) = service not found.
              try to run the app first on tomcat with no changes.
              if everything is fine & working propertly, then you
              should be looking into websphere specific configurations for the app.

              Comment


              • #8
                Sounds good. I will try to run on tomcat and will post my result.

                Thanks

                Comment

                Working...
                X