I am getting two elements of my soap function instead of one. See the example below. Does anybody know why in Axis 1.1 and 1.2 alpha this would be happening?
Thanks in advance,
Tom


<soapenv:Body>
<testpostdata soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<testpostdata xsi:type="xsd:string">
Stuff
</testpostdata>
</testpostdata>
</soapenv:Body>
</soapenv:Envelope>




/*
* arClientSOAP.java
*
* Created on November 17, 2003, 9:31 PM
*/

package org.masstech.pts;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.client.Stub;
import org.apache.axis.encoding.*;
import org.apache.axis.message.SOAPHeaderElement;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.*;
import javax.xml.soap.SOAPElement;

// For Debugging Purposes

/**
*
* @author  tbolioli
*/

public class SOAP {
private String m_strURL;
private String m_strBase;
private String m_strUserName;
private String m_strPassword;
private Service m_service = new Service();
/** Creates a new instance of arClientSOAP */
public SOAP(String URI, String strBase, String strUserName, String strPassword) {
m_strBase = strBase;
m_strURL = URI;
m_strUserName = strUserName;
m_strPassword = strPassword;
}
public String PostMonthlyStringTest(String strXML){
return(this.PostString(strXML,"testpostdata"));
}
public String PostMonthlyString(String strXML){
return (this.PostString(strXML,"postdata"));
}
private String PostString(String strXML, String strMethod){
String strAction = m_strBase + strMethod;
String retString = "";
try {
// Build the call.
Call call = (Call) m_service.createCall();
call.setTargetEndpointAddress(new URL(m_strURL));
//call.setOperationName(new QName(strAction, strMethod));
call.setOperationName(new QName(strMethod));
// The next two lines are for compatibility
// for VB.NET WSDL services.
//call.setProperty(call.SOAPACTION_USE_PROPERTY, new Boolean(true));
//call.setProperty(call.SOAPACTION_URI_PROPERTY, action);
call.setUseSOAPAction(true);
call.setSOAPActionURI(strAction);
// This creates the header used for authentication.
SOAPHeaderElement header = new SOAPHeaderElement(m_strBase,"cAuthentication");
SOAPElement UserName = header.addChildElement("UserName");
SOAPElement Password = header.addChildElement("Password");
// This populates that header with the values
UserName.addTextNode(m_strUserName);
Password.addTextNode(m_strPassword);
// This adds the header to the envelope
call.addHeader(header);
Object[] params = {strXML};
call.addParameter(strMethod, XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
// Invoke the call.
String ret = "";
try {
ret = (String)call.invoke(params);
//ret = (String) call.invoke( new Object[] { strXML.toString() } );
}
catch( Exception e ) {
//System.err.println("Caught Exception (" + e.getFaultCode() + "): " + e.getMessage());
System.err.println("Caught Exception (" + e.toString() + ")");
//System.exit(-1);
}
// Check the response.
retString = ret.toString();
}
catch(Exception e) {
e.printStackTrace();
}
return(retString);
}
}





Reply via email to