1 2 Previous Next 20 Replies Latest reply on Jan 18, 2008 5:38 AM by Salva Carsi

    Cannot obtain java type mapping for: {http://org.mazurek.ws/

    Adam Newbie

      I have deployed ws - endpoint is ejb3 component, which has method:
      public long numOfBooksByAuthor(Author author) ...
      Author is an entity bean. After I have deployed ws I can see the wsdl file and then I include it to my client application, but when I invoke ws i get exception:
      Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://org.mazurek.ws/jsr181ejb}Author

      My wsdl file:
      <definitions name='MyService' targetNamespace='http://org.mazurek.ws/jsr181ejb' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://org.mazurek.ws/jsr181ejb' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

      <schema elementFormDefault='qualified' targetNamespace='http://org.mazurek.ws/jsr181ejb' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://org.mazurek.ws/jsr181ejb' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>






































      <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>

      <soap:operation soapAction=''/>

      <soap:body namespace='http://org.mazurek.ws/jsr181ejb' use='literal'/>


      <soap:body namespace='http://org.mazurek.ws/jsr181ejb' use='literal'/>




      <soap:operation soapAction=''/>

      <soap:body namespace='http://org.mazurek.ws/jsr181ejb' use='literal'/>


      <soap:body namespace='http://org.mazurek.ws/jsr181ejb' use='literal'/>






      <soap:address location='http://adam:8080/jsr181ejb/EJB3Bean'/>




      What is wrong? I have no idea :((
      Help me

      Thanks in advance,
      Adam

        • 1. Re: Cannot obtain java type mapping for: {http://org.mazurek
          Adam Newbie

          With primitives everything works fine.
          I have changed the argument for WebMethod to simple class with two attributes and get/set methods. My wsdl file:

          <definitions name="MyService" targetNamespace="http://org.mazurek.ws/jsr181ejb" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://org.mazurek.ws/jsr181ejb" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

          <schema elementFormDefault="qualified" targetNamespace="http://org.mazurek.ws/jsr181ejb" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://org.mazurek.ws/jsr181ejb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


































          <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>


          <soap:operation soapAction=""/>

          <soap:body namespace="http://org.mazurek.ws/jsr181ejb" use="literal"/>


          <soap:body namespace="http://org.mazurek.ws/jsr181ejb" use="literal"/>




          <soap:operation soapAction=""/>

          <soap:body namespace="http://org.mazurek.ws/jsr181ejb" use="literal"/>


          <soap:body namespace="http://org.mazurek.ws/jsr181ejb" use="literal"/>






          <soap:address location="http://adam:8080/jsr181ejb/EJB3Bean"/>




          Maybe it is something wrong with namespaces in element?
          I don't believe that no one knows the answer for my problem :(

          • 2. Re: Cannot obtain java type mapping for: {http://org.mazurek
            Andreas Herbig Newbie

            Hi admzrk.

            I am not sure if I understood your problem right. When you are creating an object with primitive types everything works fine... You should watch out this side. It is JSR-109 but i don't think that the rules for value types has been changed with JSR-181 too. (Search for the "Working with JAX-RPC" part)

            http://java.sun.com/developer/technicalArticles/J2EE/j2ee_ws/

            By following these rules for my webservice everything works fine with this Eclipse plugin - maybe this is useful for you too - (http://www.eclipse.org/webtools/jst/components/ws/M4/tutorials/WebServiceExplorer.html) But my colleague is not able to connect with C#.NET.

            Greets Andy

            • 3. Re: Cannot obtain java type mapping for: {http://org.mazurek
              Adam Newbie

              Hi Andy
              Thanks for help

              It's so strange - in Eclipse Web Service Explorer my service with class-argument works fine!
              But my problem is to write a standalone client? My code:

              ServiceFactory factory = ServiceFactory.newInstance();
              URL wsdlLocation = new URL("http://adam:8080/jsr181ejb/EJB3Bean?wsdl");
              QName serviceName = new QName("http://org.mazurek.ws/jsr181ejb", "MyService");
              ServiceImpl service = (ServiceImpl)factory.createService(wsdlLocation, serviceName);
              Call call = service.createCall();

              QName operationName = new QName("http://org.mazurek.ws/jsr181ejb", "numOfBooksByAuthor");



              Param author = new Param();
              author.setFirstName("Aaa");
              author.setLastName("bbbb");
              Object retObj = call.invoke(new Object[]{author});
              System.out.println(retObj.toString());

              is throws exception:
              Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://org.mazurek.ws/jsr181ejb}Param
              I think that something is wrong in my client code - may someone will help me.

              Adam

              • 4. Re: Cannot obtain java type mapping for: {http://org.mazurek
                Thomas Diesler Master

                Your DII client does not have a jaxrpc-mapping.xml. You can use

                ServiceFactoryImpl.createService(wsdlURL, serviceName, mappingURL)
                



                • 5. Re: Cannot obtain java type mapping for: {http://org.mazurek
                  Justin Bertram Newbie

                  Thomas,

                  Can you explain a little bit more about the mappingURL?

                  I am trying to write a simple DII client JUnit test. I looked at http://fisheye.jboss.com/viewrep/JBossWS/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceFactoryImpl.java?r=275 which you posted in another thread and I am trying use code from it to grab a local copy of the jaxrpc-mapping.xml (sitting in the same directory as the JUnit's class file). Here is my code:

                  public void testEchoString() throws Exception {
                   ServiceFactoryImpl factory = new ServiceFactoryImpl();
                   URL wsdlLocation = new URL("http://jbertr1005:8080/jbossTest2/JBossTest2?wsdl");
                   ClassLoader cl = Thread.currentThread().getContextClassLoader();
                   URL mappingLocation = cl.getResource("jaxrpc-mapping.xml");
                   QName serviceName = new QName("http://us.mycompany.com/jbosstest2/1.0", "JBossTest2");
                   ServiceImpl service = (ServiceImpl) factory.createService(wsdlLocation, serviceName, mappingLocation);
                   Call call = service.createCall();
                   QName operationName = new QName("http://us.mycompany.com/jbosstest2/1.0", "prescreen");
                   call.setOperationName(operationName);
                   call.setProperty(Call.USERNAME_PROPERTY, "webServiceTestUser");
                   call.setProperty(Call.PASSWORD_PROPERTY, "webServicePassword");
                   assertFalse(call.isParameterAndReturnSpecRequired(operationName));
                   Object retObj = call.invoke(new Object[] { new JBossTest2Request() });
                   }


                  However, I am still getting:

                  org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://us.mycompany.com/jbosstest2/1.0}prescreen
                   at org.jboss.ws.metadata.JSR109MetaDataBuilder.buildParameterMetaDataDoc(JSR109MetaDataBuilder.java:442)
                   at org.jboss.ws.metadata.JSR109MetaDataBuilder.setupOperationsFromWSDL(JSR109MetaDataBuilder.java:193)
                   at org.jboss.ws.metadata.JSR109ClientMetaDataBuilder.buildMetaDataInternal(JSR109ClientMetaDataBuilder.java:207)
                   at org.jboss.ws.metadata.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:122)
                   at org.jboss.ws.metadata.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:78)
                   at org.jboss.ws.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:96)
                   at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
                   at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:142)
                   at com.acxiom.us.test.ws.WSTestCase.testEchoString(WSTestCase.java:64)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at junit.framework.TestCase.runTest(TestCase.java:154)
                   at junit.framework.TestCase.runBare(TestCase.java:127)
                   at junit.framework.TestResult$1.protect(TestResult.java:106)
                   at junit.framework.TestResult.runProtected(TestResult.java:124)
                   at junit.framework.TestResult.run(TestResult.java:109)
                   at junit.framework.TestCase.run(TestCase.java:118)
                   at junit.framework.TestSuite.runTest(TestSuite.java:208)
                   at junit.framework.TestSuite.run(TestSuite.java:203)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
                  
                  


                  • 6. Re: Cannot obtain java type mapping for: {http://org.mazurek
                    Derek Lewis Newbie

                    I'm having this same problem.
                    I don't understand why a jaxrpc-mapping.xml would be necessary for this, if I'm using JSR-181 annotations. I don't have any other configuration files, it's all in annotations. If I comment out all the remote-methods that have JavaBeans as return types or parameters, it all works great. But as soon as I pass one of my JavaBeans as an argument, I get the same error as has been posted here already by adam.
                    The JavaBeans I'm talking about all have public no-arg constructors, getter/setter methods for all fields (which are String or primitives), and they don't implement java.rmi.Remote.

                    From http://java.sun.com/developer/technicalArticles/J2EE/j2ee_ws/


                    JAX-RPC also supports something called a value type, which is a class that can be passed between a client and a service as a parameter or a return value. A value type must follow these rules:

                    * It must have a public default constructor.
                    * It must not implement java.rmi.Remote.
                    * Its fields must be JAX-RPC supported types. Also, a public field cannot be final or transient, and a non-public field must have the corresponding getter and setter methods.


                    • 7. Re: Cannot obtain java type mapping for: {http://org.mazurek
                      Adam Newbie

                      Yep. And the worst thing is that in docs there is no example how to use generated client and jaxrpc-mapping.xml file. Maybe someone can give an example?

                      • 8. Re: Cannot obtain java type mapping for: {http://org.mazurek
                        Derek Lewis Newbie

                        I don't understand why I would even need to use an xml file. I haven't written or generated a single xml file yet, and everything was working fine until I started trying to use "value types". Using annotations, as far as I know, I shouldn't be required to do anything in xml.

                        • 10. Re: Cannot obtain java type mapping for: {http://org.mazurek
                          Nx Lp Newbie

                          i still have an error:

                          "Cannot obtain java type mapping for..."

                          i don't know how to specify where my jaxrpc-mapping is.
                          i know that is in the EB3 file in the folder: META-INF.

                          how can I solve this?

                          • 11. Re: Cannot obtain java type mapping for: {http://org.mazurek
                            Tim Newbie

                            I am having the same problem with J2EE 1.4


                            It works fine for primative types but nothing else. Also if I try document/literal I get the same thing.

                            [java] org.jboss.ws.WSException: Cannot obtain java type mapping for: {www.aware-services.co.uk/ws/hello/types}sayHello


                            my wsdl:

                            ?

                            ?

                            ?

                            ?




                            ?

                            ?








                            ?



                            ?



                            ?

                            ?





                            ?

                            <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
                            ?

                            <soap:operation soapAction=""/>
                            ?

                            <soap:body use="literal"/>

                            ?

                            <soap:body use="literal"/>



                            ?

                            ?

                            <soap:address location="http://Monkey:8080/hello/Hello"/>




                            my mapping:
                            <?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
                            <package-mapping>
                            <package-type>myejbws</package-type>
                            www.aware-services.co.uk/ws/hello/types
                            </package-mapping>
                            <java-xml-type-mapping>
                            <java-type>myejbws.HelloEndpoint_sayHello_RequestStruct</java-type>
                            <root-type-qname xmlns:typeNS='www.aware-services.co.uk/ws/hello/types'>typeNS:sayHello</root-type-qname>
                            <qname-scope>complexType</qname-scope>
                            <variable-mapping>
                            <java-variable-name>string_1</java-variable-name>
                            <xml-element-name>String_1</xml-element-name>
                            </variable-mapping>
                            </java-xml-type-mapping>
                            <java-xml-type-mapping>
                            <java-type>myejbws.HelloEndpoint_sayHello_ResponseStruct</java-type>
                            <root-type-qname xmlns:typeNS='www.aware-services.co.uk/ws/hello/types'>typeNS:sayHelloResponse</root-type-qname>
                            <qname-scope>complexType</qname-scope>
                            <variable-mapping>
                            <java-variable-name>result</java-variable-name>
                            <xml-element-name>result</xml-element-name>
                            </variable-mapping>
                            </java-xml-type-mapping>
                            <service-interface-mapping>
                            <service-interface>myejbws.HelloService</service-interface>
                            <wsdl-service-name xmlns:serviceNS='www.aware-services.co.uk/ws/hello'>serviceNS:HelloService</wsdl-service-name>
                            <port-mapping>
                            <port-name>HelloEndpointPort</port-name>
                            <java-port-name>HelloEndpointPort</java-port-name>
                            </port-mapping>
                            </service-interface-mapping>
                            <service-endpoint-interface-mapping>
                            <service-endpoint-interface>myejbws.HelloEndpoint</service-endpoint-interface>
                            <wsdl-port-type xmlns:portTypeNS='www.aware-services.co.uk/ws/hello'>portTypeNS:HelloEndpoint</wsdl-port-type>
                            <wsdl-binding xmlns:bindingNS='www.aware-services.co.uk/ws/hello'>bindingNS:HelloEndpointBinding</wsdl-binding>
                            <service-endpoint-method-mapping>
                            <java-method-name>sayHello</java-method-name>
                            <wsdl-operation>sayHello</wsdl-operation>
                            <wrapped-element/>
                            <method-param-parts-mapping>
                            <param-position>0</param-position>
                            <param-type>java.lang.String</param-type>
                            <wsdl-message-mapping>
                            <wsdl-message xmlns:wsdlMsgNS='www.aware-services.co.uk/ws/hello'>wsdlMsgNS:HelloEndpoint_sayHello</wsdl-message>
                            <wsdl-message-part-name>String_1</wsdl-message-part-name>
                            <parameter-mode>IN</parameter-mode>
                            </wsdl-message-mapping>
                            </method-param-parts-mapping>
                            <wsdl-return-value-mapping>
                            <method-return-value>java.lang.String</method-return-value>
                            <wsdl-message xmlns:wsdlMsgNS='www.aware-services.co.uk/ws/hello'>wsdlMsgNS:HelloEndpoint_sayHelloResponse</wsdl-message>
                            <wsdl-message-part-name>result</wsdl-message-part-name>
                            </wsdl-return-value-mapping>
                            </service-endpoint-method-mapping>
                            </service-endpoint-interface-mapping>
                            </java-wsdl-mapping>

                            • 12. Re: Cannot obtain java type mapping for: {http://org.mazurek
                              Lee Huay Seong Newbie

                              Once I replace the jboss-jaxrpc.jar with the following jars from apache, it works fine.

                              ant.jar
                              ant-axis.jar
                              common-discovery.jar
                              common-discovery-0.2.jar

                              look for the jboss-jaxrps.jar at the {JBOSS_HOME}/client and {JBOSS_HOME}/server/lib. Back it up and replace it with the Jars above. Re-deploy your application by re-starting the server.

                              It works for me without a single artifact created for the client. FYI, my return type is only String. It works for me.

                              • 13. Re: Cannot obtain java type mapping for: {http://org.mazurek
                                Lee Huay Seong Newbie

                                Hi Guys,

                                I am not sure you guys already found any solution to this problem yet. I was having the same problem while using DII to access the WS. I have tried the jaxrpc-mapping.xml file that generated by the wstools, this goes thru the "createService" function call but having problem again while creating the proxy when calling the "getPort" function.

                                Finally, I found a way to resolve this. I replace the jboss-jaxrpc.jar located at {JBOSS_HOME}/client and {JBOSS_HOME}/server/lib with the following jars from apeche: -

                                a) axis.jar
                                b) axis-ant.jar
                                c) common-discovery.jar
                                d) common-discovery-0.2.jar

                                and I got the final proxy created without any error. FYI, my return types are all String. I am not sure if they are oter custom type, we should need a jaxrpc-mapping.xml file.

                                I think it is really bad to generated a jaxrpc-mapping.xml file for the client, especially for DII. Seems like the jboss-jaxrpc.jar is requiring this mapping file for getting the java type.

                                • 14. Re: Cannot obtain java type mapping for: {http://org.mazurek
                                  Marco Novice

                                  Hello all,
                                  did anyone find a *definitive* solution to this problem?

                                  my webservice has this signagure

                                  Agency[] testAgencies(Agency[] in)

                                  and even though i can successfully deplloy my WS, when i generate client classes i am receiving this exception

                                  creating service....
                                  Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type map
                                  ping for: {http://org.jboss.ws/ejb3ws}Agency.Array
                                   at org.jboss.ws.deployment.JSR109MetaDataBuilder.buildParameterMetaDataR
                                  pc(JSR109MetaDataBuilder.java:247)
                                   at org.jboss.ws.deployment.JSR109MetaDataBuilder.setupOperationsFromWSDL
                                  (JSR109MetaDataBuilder.java:196)
                                   at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaDataInte
                                  rnal(JSR109ClientMetaDataBuilder.java:208)
                                   at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR
                                  109ClientMetaDataBuilder.java:126)
                                   at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR
                                  109ClientMetaDataBuilder.java:82)
                                   at org.jboss.ws.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:96)
                                   at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryIm
                                  pl.java:157)
                                   at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryIm
                                  pl.java:142)
                                   at ws.jboss.org.samples.jsr181ejb.WSFacadeTester.doTest(WSFacadeTester.j
                                  ava:49)
                                   at ws.jboss.org.samples.jsr181ejb.WSFacadeTester.main(WSFacadeTester.jav
                                  a:36)
                                  


                                  I am using, as of now, RPC webservice.. i m going to try to use literal, but i am interested to know if anyone has solved this problem

                                  thanks in advance and regards
                                  Marco

                                  1 2 Previous Next