9 Replies Latest reply on Apr 18, 2005 8:26 AM by thomas.diesler

    problem with custom type mapping

    osataken

      i tie up with this for a long time...

      import tu.cs.ips.search.ProductList;
      import tu.cs.ips.search.SearchInfo;
      
      public interface SearchEndpoint extends Remote {
       public ProductList searchProduct(SearchInfo si)throws RemoteException;
      }


      i try to expose this this SEI to a web service. i generate wsdl and mapping file with wscompile. i can deploy it with no error but when i try to invoke in via DII client, i got warning message and exception.
      15:37:15,532 WARN [TypeMappingDescription] Class not found: com.vendora.search.searchProductResponse
      15:37:15,542 WARN [TypeMappingDescription] Class not found: com.vendora.search.searchProduct
      15:37:15,542 WARN [TypeMappingDescription] Class not found: com.vendora.search.searchProductResponse
      15:37:15,542 WARN [TypeMappingDescription] Class not found: com.vendora.search.searchProduct
      15:37:15,602 INFO [STDOUT] AxisFault
      faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
      faultSubcode:
      faultString: java.io.IOException: No serializer found for class tu.cs.ips.search.SearchInfo in registry org.apache.axis.encoding.TypeMappingImpl@55d3df
      faultActor:
      faultNode:
      faultDetail:
      {http://xml.apache.org/axis/}stackTrace: java.io.IOException: No serializer found for class tu.cs.ips.search.SearchInfo in registry org.apache.axis.encoding.TypeMappingImpl@55d3df
      at org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1474)
      at org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:888)
      .
      .
      .


      this is my config.xml (use to run wscompile)
      <?xml version="1.0" encoding="UTF-8"?>
      <configuration
       xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
       <service
       name="SearchService"
       targetNamespace="http://search.vendora.com"
       typeNamespace="http://search.vendora.com/types"
       packageName="com.vendora.search">
       <interface name="com.vendora.search.SearchEndpoint"/>
       </service>
      </configuration>



      and this is my DII Client
      serviceFactory = ServiceFactory.newInstance();
       Service service = serviceFactory.createService(new URL("http://localhost:8080/vendora/search/service?wsdl"), new QName("http://search.vendora.com", "SearchService"));
       Call call = (Call) service.createCall(new QName("http://search.vendora.com", "SearchEndpointPort"), "searchProduct");
       ProductList retstr = (ProductList) call.invoke(new Object[]{new SearchInfo(name,values)});



      My question are
      1. do i need ws4ee-deployment.xml for additional mapping (if i need,what it look like)??
      2. and how to solve this problem (i need to use DII Client)???

      thank you very much for all answer....

        • 1. Re: problem with custom type mapping
          thomas.diesler
          • 2. Re: problem with custom type mapping
            osataken

            thank you Thomas,
            i'd take a look at wikis and think that i have to use this approach

            public void testSayHello() throws Exception
             {
             ServiceFactoryImpl serviceFactory = (ServiceFactoryImpl)ServiceFactory.newInstance();
             Service service = serviceFactory.createService(wsdlURL, jaxrpcURL, ws4eeURL, SERVICE_NAME, null);
             Call call = (Call) service.createCall(new QName(NAMESPACE, "HelloPortComponent"), "sayHello");
             String retstr = (String) call.invoke(new Object[]{"Hello"});
             assertEquals("'Hello' to you too!", retstr);
             }
            


            so if i'm right, my answer are
            1. on the client side must need jaxrpc-mapping file to serialize/deserialize that the same as in the server side???

            • 3. Re: problem with custom type mapping
              osataken

              hi,
              i try DII Client follow wikis

              String NAMESPACE="http://search.vendora.com";
               final String wsdlURL="http://localhost:8080/vendora/search/service?wsdl";
               final QName SERVICE_NAME=new QName(NAMESPACE,"SearchService");
               try {
               Service service = new ServiceFactoryImpl().createService(new URL(wsdlURL),new URL("http://localhost:8080/resources/jaxrpc-mapping.xml"),null,SERVICE_NAME,null);
               Call call = (Call) service.createCall(new QName(NAMESPACE, "SearchEndpointPort"), "searchProduct");
               ProductList pl = (ProductList) call.invoke(new Object[]{new SearchInfo(name,values)});


              i got the Exception...
              15:42:20,702 WARN [TypeMappingDescription] Class not found: com.vendora.search.SearchEndpoint_searchProduct_ResponseStruct
              15:42:20,702 WARN [TypeMappingDescription] Class not found: com.vendora.search.SearchEndpoint_searchProduct_RequestStruct
              15:42:20,702 WARN [TypeMappingDescription] Class not found: com.vendora.search.SearchEndpoint_searchProduct_ResponseStruct
              15:42:20,702 WARN [TypeMappingDescription] Class not found: com.vendora.search.SearchEndpoint_searchProduct_RequestStruct
              15:42:20,753 INFO [STDOUT] AxisFault
              faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
              faultSubcode:
              faultString: java.io.IOException: No serializer found for class tu.cs.ips.search.SearchInfo in registry org.apache.axis.encoding.TypeMappingImpl@ba117b
              faultActor:
              faultNode:
              faultDetail:
              {http://xml.apache.org/axis/}stackTrace: java.io.IOException: No serializer found for class tu.cs.ips.search.SearchInfo in registry org.apache.axis.encoding.TypeMappingImpl@ba117b
              at org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1474)
              at org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:888)
              at org.apache.axis.message.RPCParam.serialize(RPCParam.java:270)
              at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:446)
              at org.apache.axis.message.SOAPElementAxisImpl.output(SOAPElementAxisImpl.java:1476)
              at org.apache.axis.message.SOAPBodyAxisImpl.outputImpl(SOAPBodyAxisImpl.java:152).
              .
              .
              .


              do i need to create server artifacts like "SearchEndpoint_searchProduct_RequestStruct" with wscompile and deploy it .???

              • 4. Re: problem with custom type mapping
                dhaval_shah_m

                I am running into a similiar kind of issue. I need to fetch complext data types and preferably over DII. However it fails.

                As I understand after going through the documents/resources presented so far, jax-rpc does not have the capability of marshalling/unmarshalling custom data types.

                I tried static binding but it gives me the following error :

                [Simple Data type] Components list is : component List
                [Complex Data Type]
                java.rmi.RemoteException: Runtime exception; nested exception is:
                unexpected element name: expected=result, actual={http://com.test.controller/types}Asset
                at com.sun.xml.rpc.client.StreamingSender._handleRuntimeExceptionInSend(StreamingSender.java:318)
                at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:300)
                at com.test.controller.client.stub.IComponentView_Stub.getAsset(IComponentView_Stub.java:68)
                at com.test.controller.ComponentUI.testStaticWebServiceAccess(ComponentUI.java:32)
                at com.test.controller.ComponentUI.main(ComponentUI.java:82)
                ... 3 more

                The above exception trace is from a java client. Note that the single data type comes through, the complex data type does not.

                I used wscompile to generate the client side stubs. The wsdl type is rpcliteral. I am using jwsdp1.5 to generate the wsdl and client side stub and JBoss 4.0.9.

                Note that I do not have issues with deploying an endpoint, I am looking for examples to consume a complex data type.

                • 5. Re: problem with custom type mapping
                  thomas.diesler

                  The Axis deployment descriptor (*.wsdd) is generated from the meta data given in jaxrpc-mapping.xml, the wsdl and bean introspection.

                  So if there is a type mapping in jaxrpc-mappping.xml you should also have the target class on the classpath.

                  Anonymous complexType definitions in XML schema are a problem, it is good to avoid them if you can.

                  AFAIK, there is no limitation on complex types


                  As I understand after going through the documents/resources presented so far, jax-rpc does not have the capability of marshalling/unmarshalling custom data types.



                  Have you checked out
                  http://www.jboss.org/wiki/Wiki.jsp?page=WSDOCClientStepByStep



                  • 6. Re: problem with custom type mapping
                    dhaval_shah_m

                    hanks for sharing the above information. However the example in the doc above is from a WS4EE client.

                    The need I have is to access complex types from Standalone clients. As such there will be no containers to map the jax-rpc mapping.xml with the wsdl and hide the details of object serialization/deserialization from the user.

                    I need to see a working example of a complex type passed between a standalone java client [not in any app server container] and a J2EE 1.4 WS. All the examples are from an application container.

                    And yes being new to Webservices is not helping either.

                    • 7. Re: problem with custom type mapping
                      thomas.diesler

                      Have you read http://www.jboss.org/wiki/Wiki.jsp?page=WSRPCClientStepByStep ?

                      It explains why it is not at all unreasonable to JBoss on the client side. JBossWS is about J2EE compliant web services on the server *and* client side.

                      If you are looking for a standalone (not J2EE compliant) WS client that does not use the WS4EE client programming model, you might need to configure the Call manually. Have a look at the various client side wikis, to get a better idea whether you want to use JBossWS on the client side or not.

                      On the client side, you could of course use any other SOAP stack as well (i.e. jwsdp, axis). Remember there is a fundamental disconnect between the client/server side of a WS. The client should be able to work solely from the information given in the wsdl. jwsdp and axis both have tools to generate all you need from a remote wsdl. If you use JBossWS on the client you still generate the SEI, SI, User types, jaxrpc-mapping.xml from WSDL but not use the jwsdp propriatary stubs and serializers. The wiki expailns that step by step.

                      Good luck

                      • 8. Re: problem with custom type mapping
                        dhaval_shah_m

                        It turns out that I was using JBOSS 4.0.1 RC1 which somehow mangles the returns. Using JBOSS 4.0.1 SP1 solved the problem of passing beans across the wire - yes even to a standalone client

                        However, adding beans within beans did not work. Raised the same error. The workaround was to xmlencode the beans and send it across as strings. Turned out, it is faster, though I do not have the numbers yet.

                        • 9. Re: problem with custom type mapping
                          thomas.diesler

                          I would assume that this workarround is not valid, as it breaks the structural contract between the WS client/server. The structure of the complex type should be defined in xml schema and referenced from the wsdl.