[
https://issues.apache.org/jira/browse/AXIS2-3299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574345#action_12574345
]
Davanum Srinivas commented on AXIS2-3299:
-----------------------------------------
Charitha,
Try
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
"UTF-16LE");
that works,
dims
> Interop issue: Utf16 Mtom failure with MS WCF
> ----------------------------------------------
>
> Key: AXIS2-3299
> URL: https://issues.apache.org/jira/browse/AXIS2-3299
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Affects Versions: 1.3
> Environment: server=WCF, Client=jdk15/axis2-1.3/winxp
> Reporter: Charitha Kankanamge
> Assignee: Thilina Gunarathne
> Priority: Blocker
>
> Interop fails with following exception when mtom is used with utf 16 encoding.
> org.apache.axis2.AxisFault: The input stream for an incoming message is null.
> at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:71)
> at
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326)
> at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
> at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
> at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> at
> org.tempuri.MtomServiceStub.EchoBinaryAsString(MtomServiceStub.java:239)
> at
> org.tempuri.tempuri.mtom.soap11.utf16.MtomServiceSoap11Utf16StubTest.testEchoBinaryAsString(MtomServiceSoap11Utf16StubTest.java:52)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> Steps to reproduce
> ================
> - Generate client stubs using the following MS Interop endpoint
> http://131.107.72.15/MTOM_Service_Indigo/Soap11MtomUtf16.svc?wsdl
> - Write a client and try to invoke service
> ie:-
> public class MtomServiceSoap11Utf16StubTest extends TestCase {
> MtomServiceStub stub = null;
> protected void setUp() throws Exception {
> stub = new
> MtomServiceStub("http://131.107.72.15/MTOM_Service_Indigo/Soap11MtomUtf16.svc/MtomTest");
>
> stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM,
> Constants.VALUE_TRUE);
>
> stub._getServiceClient().getOptions().setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,"utf-16");
>
> //
> stub._getServiceClient().getOptions().setProperty(Constants.Configuration.TRANSPORT_URL,
> //
> "http://localhost:8085/MTOM_Service_Indigo/Soap11MtomUtf16.svc/MtomTest");
>
> stub._getServiceClient().getOptions().setProperty(Constants.Configuration.TRANSPORT_URL,
>
> "http://localhost:8085/MTOM_Service_Indigo/Soap11MtomUtf16.svc/MtomTest");
> }
> public void testEchoBinaryAsString() {
> String testString = "new test string";
> DataHandler dataHandler = new DataHandler(new
> ByteArrayDataSource(testString.getBytes()));
> try {
> String returnStirng = stub.EchoBinaryAsString(dataHandler);
> assertEquals(returnStirng, "new test string");
> } catch (RemoteException e) {
> e.printStackTrace();
> fail();
> }
> }
> public void testEchoStringAsBinary() {
> String testString = "new test string";
> try {
> DataHandler dataHandler = stub.EchoStringAsBinary(testString);
> String result = getStringFromDataHandler(dataHandler);
> assertEquals(result,"new test string");
> } catch (RemoteException e) {
> fail();
> } catch (IOException e) {
> fail();
> }
> }
> public void testEchoBinaryArrayAsStringArray() {
> String testString = "new test string";
> DataHandler dataHandlers[] = new DataHandler[2];
> dataHandlers[0] = new DataHandler(new
> ByteArrayDataSource(testString.getBytes()));
> dataHandlers[1] = new DataHandler(new
> ByteArrayDataSource(testString.getBytes()));
> ArrayOfbase64Binary arrayOfbase64Binary = new ArrayOfbase64Binary();
> arrayOfbase64Binary.setBase64Binary(dataHandlers);
> try {
> String[] result =
> stub.EchoBinaryArrayAsStringArray(arrayOfbase64Binary).getString();
> assertEquals(result.length,2);
> assertEquals(result[0],"new test string");
> assertEquals(result[1],"new test string");
> } catch (RemoteException e) {
> fail();
> }
> }
> public void testEchoBinaryFieldAsString() {
> String testString = "new test string";
> DataHandler dataHandler = new DataHandler(new
> ByteArrayDataSource(testString.getBytes()));
> MtomTestStruct mtomTestStruct = new MtomTestStruct();
> mtomTestStruct.setName("test data");
> mtomTestStruct.setArray(dataHandler);
> try {
> String result = stub.EchoBinaryFieldAsString(mtomTestStruct);
> assertEquals(result,"new test string");
> } catch (RemoteException e) {
> fail();
> }
> }
> public void testEchoBinaryHeaderAsString() {
> String testString = "new test string";
> DataHandler dataHandler = new DataHandler(new
> ByteArrayDataSource(testString.getBytes()));
> ByteArray byteArray = new ByteArray();
> byteArray.setByteArray(dataHandler);
> try {
> String result = stub.EchoBinaryHeaderAsString(byteArray);
> assertEquals(result,"new test string");
> } catch (RemoteException e) {
> fail();
> }
> }
> public String getStringFromDataHandler(DataHandler dataHandler)
> throws IOException {
> byte[] bytes = new byte[128];
> int length = dataHandler.getInputStream().read(bytes);
> return new String(bytes, 0, length);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]