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 Greg Pedder <gp...@tampabay.rr.com> on 2004/02/03 03:37:45 UTC
How The Heck To Use Helper Class To Create SOAP Header
I need a custom header (see below) added to my soap message. When I created the client
stubs using WSDL2Java, nothing was created for the header even though it was listed in the
WSDL document. So, I ran WSDL2Java again giving it the "-H" option for the helper classes.
So, I now have a helper class (StartHeader - see below) that defines the custom header, but
I have no idea how to take this class and create a SOAP header.
Any help would be fantastic.
/*********************************************************************************/
What I need in the SOAP Header
/*********************************************************************************/
<soapenv:Header>
<StartHeader soapenv:mustUnderstand="0" xmlns="http://openuri.org/2002/04/soap/conversation/">
<conversationID>GSP-6555555555</conversationID>
</StartHeader>
</soapenv:Header>
/*********************************************************************************/
Helper class to create soap header.
Class created using WSDL2Java -H
/*********************************************************************************/
public class StartHeader implements java.io.Serializable {
private java.lang.String conversationID;
private java.lang.String callbackLocation;
public StartHeader() {
}
public java.lang.String getConversationID() {
return conversationID;
}
public void setConversationID(java.lang.String conversationID) {
this.conversationID = conversationID;
}
public java.lang.String getCallbackLocation() {
return callbackLocation;
}
public void setCallbackLocation(java.lang.String callbackLocation) {
this.callbackLocation = callbackLocation;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof StartHeader)) return false;
StartHeader other = (StartHeader) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.conversationID==null && other.getConversationID()==null) ||
(this.conversationID!=null &&
this.conversationID.equals(other.getConversationID()))) &&
((this.callbackLocation==null && other.getCallbackLocation()==null) ||
(this.callbackLocation!=null &&
this.callbackLocation.equals(other.getCallbackLocation())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getConversationID() != null) {
_hashCode += getConversationID().hashCode();
}
if (getCallbackLocation() != null) {
_hashCode += getCallbackLocation().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(StartHeader.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.openuri.org/2002/04/soap/conversation/", "StartHeader"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("conversationID");
elemField.setXmlName(new javax.xml.namespace.QName("http://www.openuri.org/2002/04/soap/conversation/", "conversationID"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("callbackLocation");
elemField.setXmlName(new javax.xml.namespace.QName("http://www.openuri.org/2002/04/soap/conversation/", "callbackLocation"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}