8 Replies Latest reply on Apr 25, 2007 1:04 PM by chui

    String[] with SOAP... Please help me!

    chui

      Hello there! I'm trying to develop a HelloWorld with JBossWS1.0.4, JBossAS4.0.5 and EJB3, but instead of returning a string "Hello World", I'd like to receive a String[]...

      If I don't create a wsdl, JBossAS autocreate a default file, where the String[] is mapped as a NMTOKENS type. I don't want that because my array [Hello World, Hello World] becomes [Hello, World, Hello, World]... So I used WStools for creating a wsdl. That's my wstools-config.xml:

      <configuration xmlns="http://www.jboss.org/jbossws-tools" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
      - <java-wsdl>
      <service name="HelloService" style="rpc" endpoint="interfaces.HelloSEI" />
      <namespaces target-namespace="http://interfaces/jaws" type-namespace="http://org.jboss.ws/samples/rpcstyle/types" />
      <mapping file="jaxrpc-mapping.xml" />
      <webservices servlet-link="HelloService" />
      </java-wsdl>
      </configuration>


      I found something similar on the userguide and I used interfaces/jaws because JBoss complained if I didn't. WStools generated the wsdl and the mapping xml. Here is the wsdl: http://www.linux.ime.usp.br/~chui/HelloService.wsdl

      However, isn't accepted when deploying the EJB, so I have to change that to HelloServicePort. And I don't know what I should write as <soap:address location> =/ Yeah, I'm newbie.

      This is the generated jaxrpc-mapping.xml:

      <?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>interfaces</package-type>
      <namespaceURI>http://org.jboss.ws/samples/rpcstyle/types</namespaceURI>
      </package-mapping>
      - <service-interface-mapping>
      <service-interface>interfaces.HelloService</service-interface>
      <wsdl-service-name xmlns:serviceNS="http://interfaces/jaws">serviceNS:HelloService</wsdl-service-name>
      - <port-mapping>
      <port-name>HelloSEIPort</port-name>
      <java-port-name>HelloSEIPort</java-port-name>
      </port-mapping>
      </service-interface-mapping>
      - <service-endpoint-interface-mapping>
      <service-endpoint-interface>interfaces.HelloSEI</service-endpoint-interface>
      <wsdl-port-type xmlns:portTypeNS="http://interfaces/jaws">portTypeNS:HelloSEI</wsdl-port-type>
      <wsdl-binding xmlns:bindingNS="http://interfaces/jaws">bindingNS:HelloSEIBinding</wsdl-binding>
      - <service-endpoint-method-mapping>
      <java-method-name>hello</java-method-name>
      <wsdl-operation>hello</wsdl-operation>
      - <method-param-parts-mapping>
      <param-position>0</param-position>
      <param-type>java.lang.String</param-type>
      - <wsdl-message-mapping>
      <wsdl-message xmlns:wsdlMsgNS="http://interfaces/jaws">wsdlMsgNS:HelloSEI_hello</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="http://interfaces/jaws">wsdlMsgNS:HelloSEI_helloResponse</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>


      Finally I could deploy the bean. But, when I call it using a client application, I receive this error:

      java.rmi.RemoteException: Call invocation failed; nested exception is:
      org.jboss.ws.WSException: org.jboss.ws.binding.BindingException: org.jboss.ws.jbossxb.UnmarshalException: Failed to parse source: Not supported xsdType: anyType, hashCode=-842881210


      As you can see, I never used anyType. So I tried to find where's this term... And I found it here: http://www.w3.org/2001/XMLSchema.xsd

      Now I ask you:
      1-) Why do I need to use http://interfaces/jaws ??
      2-) How can I receive the String[]??? The bean is being called, but the client can't receive the result =(

      Please help me! I REALLY NEED this to function so I can apply it to my real (and also EJB3+WS) project...

      Thanks in advance.

        • 1. Re: String[] with SOAP... Please help me!
          santhosh288

          Hello Chui,

          Even I am facing the same issue with String[] as input parameter in my WS. Did you find any solution for this? Please let me know.

          Thanks,
          Santhosh

          • 2. Re: String[] with SOAP... Please help me!
            kcp

            Did you try to wrap the array in a another class?
            Something like

            method(StringArray a)


            whereas StringArray is a class with a String[] as member.

            Regards
            Charly

            • 3. Re: String[] with SOAP... Please help me!
              thomas.diesler

              Please have a look at the array tests in the testsuit

              • 4. Re: String[] with SOAP... Please help me!
                chui

                 

                "santhosh288" wrote:
                Hello Chui,

                Even I am facing the same issue with String[] as input parameter in my WS. Did you find any solution for this? Please let me know.

                Thanks,
                Santhosh


                Hi, santhosh288 ! Unfortunately I didn't find a solution for this. =/ Watch this topic, if I find a solution I'll post it here, ok??

                "kcp" wrote:
                Did you try to wrap the array in a another class?


                Thanks, kcp, but this didn't function. I read a tutorial that suggested a class instead of String[], but I don't remember what was the error I found. Then I tried the automatic generation with WSTools and I got the files I posted before.

                "thomas.diesler@jboss.com" wrote:
                Please have a look at the array tests in the testsuit


                Sorry, but... Where can I find the testsuit?? Any URL or something like that?

                ---------------

                Thank you all for the answers!

                • 5. Re: String[] with SOAP... Please help me!
                  chui

                  Oh, I found the testsuit on CVS repository... Thanks, I'll have a look in it.

                  • 6. Re: String[] with SOAP... Please help me!
                    thomas.diesler
                    • 7. Re: String[] with SOAP... Please help me!
                      chui

                      Well, Thomas... I did what you told me, but I have no results =/
                      I had a look at the source of JBWS632 in testsuite, I have almost the same things. Here are the differences:

                      - The test's WSDL has its own namespaces and uses an "import" tag inside the schema. The namespaces I use are http://interfaces/jaws because JBossAS asked me for it when deploying the webservice. I also use http://interfaces/jaws/types, because I don't know what should I use as xmlns:tns and schema targetnamespace.

                      - The test's jaxrpc-mapping.xml is almost the same as mine, but JBWS632 includes a String[][] result.

                      - Finally, JBWS632 testcase uses JSR-109 client, with JNDI lookup. I'm using configured DII... Both need jaxrpc-mapping.xml, so I think the problem wouldn't disappear.

                      Well, I'll try installing other JBossAS and use JBossWS 1.2.1. Hope that works, I'm crazy with this problem...

                      Thanks

                      • 8. Re: String[] with SOAP... Please help me!
                        chui

                        Here I am again... and with the same problem. =/
                        I tried other JBoss A.Servers and the results were:

                        - JBossAS 4.2.0 CR1: I could deploy an EJB, but couldn't deploy a webservice. I tried the JAXWS userguide's example, but I receive "String out of range -1".

                        - JBossAS 4.2.0 CR2: the same problem above.

                        - JBossAS 5.0.0 Beta1: the AS doesn't recognize my deployed jar.

                        - JBossAS 5.0.0 Beta2: the same problem above.

                        Well, I'd like to solve the String[] problem using JBossAS 4.0.5 and JBossWS 1.0.4... Santhosh288, did you find any solution?