6 Replies Latest reply on Mar 2, 2012 11:06 AM by davided80

    Apostrophe in target namespace

    davided80

      Hi,

      I have a wsdl where the target namespace contains an apostrophe. Ex:

       

      <wsdl:definitions

      ...

      xmlns:tns="glass's/WebServices"

      targetNamespace="glass's/WebServices"

      ...

      >

      ...

       

      When I generate the classes using wsconsume, everything works fine. But when I deploy the webservice on JBoss AS 4.2.3 the service is not deployed because of the single quote in the namespace of the generated wsdl.

       

      This is the first line of the error in the server log:

      ERROR [org.jboss.wsf.common.DOMUtils] Cannot parse: <definitions name='vvWSService' targetNamespace='glass's/WebServices' xmlns='http://schemas.xmlsoap.org/wsdl/' ...

      ...

      Caused by: java.io.IOException: org.xml.sax.SAXParseException: Element type "definitions" must be followed by either attribute specifications, ">" or "/>".

       

       

      Thanks,

      Davide

        • 1. Re: Apostrophe in target namespace
          kimba74

          Hi Davide,

           

          First of all having apostrophes in a URL is not necessarily a good move, however I realize that sometimes you have no chance and have to go with it.

           

          Have you tried replacing the apostrophe with its escape sequence: %27 (I believe it is)?

          So your Namespace would read like this:

           

               xmlns:tns="glass%27s/WebServices"

          • 2. Re: Apostrophe in target namespace
            davided80

            In my defence, this is a third party WSDL and I can't change it. My surname has an apotrophe in it and I know very well how many problems it can cause (have you noticed my login on the left?).

             

            That said, I wonder if this is a bug of JBoss AS or JBossWS. if the specification allows the use of apostrophe in the target namespace (I'm not sure), It should be possible to generate clent and web service without problems. I haven't investigated a lot on this issue so I'm probably wrong.

             

            Thank you very much for the suggestion, I will try it.

            • 3. Re: Apostrophe in target namespace
              davided80

              I've tried to use the escaped character but it didn't work. When I use the client I have this exception:

               

              8:02:56,867 TRACE JBossEntityResolver:459 - Trying to resolve systemId as a URL

              18:02:56,870 TRACE JBossEntityResolver:491 - Failed to obtain URL.InputStream from systemId: file:/tmp/JBossWS_ss%27s_WebServices_Valuation293823893321021314.xsd

              java.io.FileNotFoundException: /tmp/JBossWS_ss's_WebServices_Valuation293823893321021314.xsd (No such file or directory)

                  at java.io.FileInputStream.open(Native Method)

                  at java.io.FileInputStream.<init>(FileInputStream.java:120)

              • 4. Re: Apostrophe in target namespace
                kimba74

                Well, do you have a file called JBossWS_ss's_WebServices_Valuation293823893321021314.xsd in the /tmp folder of your operating system?

                • 5. Re: Apostrophe in target namespace
                  davided80

                  Well, it's a temporary file created when I use the client. If I look in the folder the file exists but with the %27.

                  My guess is that the client has created the file using the %27 but then it's looking for it using the ' and therefore it cannot find it.

                  • 6. Re: Apostrophe in target namespace
                    davided80

                    The only solution I've found so far is to create a SOAPHandler  that parses the SOAP message before sending the request. This way I can change the apostrophe with  &apos; in the target namespace

                     

                    This seems to work for the request I send to the WS but now I need  to do something similar with the response. Is it possible to add an handler on the client that parse the response?