You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Walter Parton <wp...@smud.org> on 2005/03/08 21:46:16 UTC

Problems sending String parameters with Axis 1.2 RC 3 client to .Net 1.1 service

Hello,
 
We have an Axis java client (Axis 1.2 RC3) that is communicating to a .Net web service correctly, however, the 
rpc encoded variable problem is cropping up and causing the .NET service to not 
correctly pull in the passed strings. We know we need to turn off the rpc 
encoding so that the Axis client will send the parameters as 
document/literal, problem is we don't know how to turn it off in the java 
client code. We suspect that with RC 3 it is doable (according to the release message it accomodates literal/document and .net). So our plead for help is - Which property do we set, or which flag do we toggle to turn off rpc and turn on literal/document?

 Any assistance would be of great help! I 
included the client code below. 
Thanks 
Walter Parton 
Documentum Consulting 

// Decompiled by DJ v3.5.5.77 Copyright 2003 Atanas Neshkov Date: 2/1/2005 
7:58:00 PM 
// Home Page : <http://members.fortunecity.com/neshkov/dj.html> - Check often 
for new version! 
// Decompiler options: packimports(3) 
// Source File Name: CalcClient.java 
package samples.userguide.example2; 
import java.io.PrintStream; 
import java.net.URL; 
import javax.xml.namespace.*; 
import javax.xml.rpc.ParameterMode; 
import org.apache.axis.client.Call; 
import org.apache.axis.client.Service; 
import org.apache.axis.encoding.TypeMappingImpl; 
import org.apache.axis.encoding.XMLType; 
import org.apache.axis.encoding.XMLType; 
import org.apache.axis.utils.Options; 
import org.apache.axis.encoding.*; 


public class rm_call 
{ 
public rm_call() 
{ 
} 
public static void main(String args[]) 
throws Exception 
{ 
Options options = new Options(args); 
String endpoint = "<http://edmw04/RM/SMUDRecord.asmx>"; 
String action = "<http://rm.com/webservices/Synchronize>"; 
//SOAPMappingREgistry smr = new SOAPMappingRegistry(); 
//StringDeserializer sd = new StringDeserializer(); 


args = options.getRemainingArgs(); 
if(args == null || args.length != 6) 
{ 
//String method = args[0]; 
//if(!method.equals("add") && !method.equals("subtract")) 
//{ 
System.err.println("Usage: rm_call prefix fileLevel subject 
author docbase documentId"); 
return; 
} 
else 
{ 
String strPrefix = new String(args[0]) ; 
String strFileLevel = new String(args[1]); 
String strSubject = new String(args[2]); 
String strAuthor = new String(args[3]); 
String strDocbase = new String(args[4]); 
String strDocId = new String(args[5]); 
String method = "Synchronize"; 
Service service = new Service(); 
Call call = (Call)service.createCall(); 
//set the target to the RMSynchronization service 
call.setTargetEndpointAddress(new URL(endpoint)); 
call.setOperationName(method); 
TypeMappingImpl.dotnet_soapenc_bugfix = true; 

call.addParameter("prefix", XMLType.XSD_STRING, 
ParameterMode.IN); 
call.addParameter("fileLevel", XMLType.XSD_STRING, 
ParameterMode.IN); 
call.addParameter("subject", XMLType.XSD_STRING, 
ParameterMode.IN); 
call.addParameter("author", XMLType.XSD_STRING, 
ParameterMode.IN); 
call.addParameter("docbase", XMLType.XSD_STRING, 
ParameterMode.IN); 
call.addParameter("documentId", XMLType.XSD_STRING, 
ParameterMode.IN); 
/* 
call.addParameter("prefix", XMLType.QNAME_LITERAL_ITEM, 
ParameterMode.IN); 
call.addParameter("fileLevel", XMLType.QNAME_LITERAL_ITEM, 
ParameterMode.IN); 
call.addParameter("subject", XMLType.QNAME_LITERAL_ITEM, 
ParameterMode.IN); 
call.addParameter("author", XMLType.QNAME_LITERAL_ITEM, 
ParameterMode.IN); 
call.addParameter("docbase", XMLType.QNAME_LITERAL_ITEM, 
ParameterMode.IN); 
call.addParameter("documentId", XMLType.QNAME_LITERAL_ITEM, 
ParameterMode.IN); 
*/ 
//String strEncode = call.getEncodingStyle(); 
//call.SEND_TYPE_ATTR = false; 
//call.addParameter("", XMLType.XSD_STRING, ParameterMode.IN); 
call.setReturnType(XMLType.XSD_STRING); 
call.setUseSOAPAction(true); 
call.setSOAPActionURI(action); 

//call.setProperty(Call.OPERATION_STYLE_PROPERTY,""); 

//call.setProperty("javax.xml.rpc.encodingstyle.namespace.uri",""); 

//call.setEncodingStyle("<http://schemas.xmlsoap.org/soap/encoding/>"); 
// System.out.println("encode = " + strEncode); 

String ret = "" ; 
//String ret = (String)call.invoke(new Object[] 
{strPrefix,strFileLevel,strSubject,strAuthor,strDocbase,strDocId}); 
try { 

ret = (String)call.invoke(new Object[] 
{strPrefix,strFileLevel,strSubject,strAuthor,strDocbase,strDocId}); 
} 
catch (Exception e) 
{ 
System.out.println("Got result : " + ret + 
e.getMessage()); 
} 
System.out.println("Got result : " + ret ); 
return; 
} 
} 
}