You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Jan Hudec <ja...@atlas.cz> on 2003/07/22 09:02:44 UTC

encoded characters in SOAP Axis

Hello,

I have very simple Axis SOAP client calling service with 3 arguments from this code:

...
    String ret = (String) call.invoke( new Object[] { "příčina","<data>test</data>", "<data>příčina</data>" } );
...

which generates this SOAP request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <send soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <arg0 xsi:type="xsd:string">příčina</arg0>
   <arg1 xsi:type="xsd:string">&lt;data&gt;test&lt;/data&gt;</arg1>
   <arg2 xsi:type="xsd:string">&lt;data&gt;p&#345;&#237;&#269;ina&lt;/data&gt;</arg2>
  </send>
 </soapenv:Body>
</soapenv:Envelope>/send>
 </soapenv:Body>
</soapenv:Envelope>

---------------------------------------------------------------------------------------------
What I really need is to set some call property to get this value in the SOAP request:

   <arg2 xsi:type="xsd:string">&lt;data&gt;příčina&lt;/data&gt;</arg2>

(in other words, to set property that I don't need to encode international characters into HTML entities (or how is this called :o)) ))

It works for me in Perl using SOAP::Simple, in Java using CapeClear pre-generated code, but I need to build my code on Apache (because of https, authentication, ...).

Here are some facts I experienced:
1] if I write only international characters into the argument, it sends them in proper way (as you can see from the argument arg0)
2] after adding "<", ">" or "&" into the argument, it converts international characters into "&#xxx;" entities (as you can see from the argument arg2)
3] I am using Axis 1_1, but I also tried it in at least 10 months old Axis with the same behaviour.
4] 
a] endpoint is hosted on Apache PHP and I took SOAP envelope from $HTTP_RAW_POST_DATA variable.
b] other endpoint was hosted on Lotus Domino Server and I took the same envelope from document.context.

If you have any ideas about it, please let me know.

Thank you,

Jan Hudec
-----------------------------------------------------------
Here is my source code:

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.io.*;

public class TestClient1 {
    public static void main(String [] args) {
        String str, whole;
        whole = "";

        try {
            String endpoint = "http://127.0.0.1/cps/cps.php";
            Service service = new Service();
            Call    call    = (Call) service.createCall();
            call.setTargetEndpointAddress( new java.net.URL(endpoint) );
            call.setOperationName(new QName("send"));
            
            //    call.setUsername("wsuser");
            //    call.setPassword("wspwd");
            
            
            
                 String ret = (String) call.invoke( new Object[] { "příčina","<data>test</data>", "<data>příčina</data>" } );
            
            
            System.out.println("Value: '" + ret + "'");
        } catch (Exception e) {
            System.err.println(e.toString());
        }
    }
}

________________________________________________________________________________
Stydím se ho vytáhnout! A jaký je váš důvod vyměnit svůj telefon za nový? 
Nokia 6610 již od 6577 Kč. http://www.atlas.cz/clickAD.asp?ad=32843