Hi all,
can someone please help me solve the following problem (it's a bit
longish)
I have the following two AXIS generated Java classes:
/**
* Customer.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.microsoft.schemas.crm._2006.WebServices;
public class Customer extends
com.microsoft.schemas.crm._2006.WebServices.CrmReference implements
java.io.Serializable {
public Customer() {
}
// Simple Types must have a String constructor
public Customer( java.lang.String _value ) {
super( _value );
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals( java.lang.Object obj ) {
if( !( obj instanceof Customer ) ) return false;
Customer other = (Customer)obj;
if( obj == null ) return false;
if( this == obj ) return true;
if( __equalsCalc != null ) {
return ( __equalsCalc == obj );
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals( obj );
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if( __hashCodeCalc ) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc( Customer.class, true );
static {
typeDesc.setXmlType( new javax.xml.namespace.QName( "
http://schemas.microsoft.com/crm/2006/WebServices", "Customer" ) );
}
/**
* 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.SimpleSerializer(
_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.SimpleDeserializer( _javaType, _xmlType,
typeDesc );
}
}
And :
/**
* CrmReference.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.microsoft.schemas.crm._2006.WebServices;
public abstract class CrmReference implements java.io.Serializable,
org.apache.axis.encoding.SimpleType {
private com.microsoft.wsdl.types.Guid value;
private boolean isNull; //
attribute
private java.lang.String name; //
attribute
private java.lang.String type; //
attribute
private int dsc; //
attribute
public CrmReference() {
}
public CrmReference( com.microsoft.wsdl.types.Guid value ) {
this.value = value;
}
// Simple Types must have a String constructor
public CrmReference( java.lang.String value ) {
this.value = new com.microsoft.wsdl.types.Guid( value );
}
/**
* Gets the isNull value for this CrmReference.
*
* @return isNull
*/
public boolean isIsNull() {
return isNull;
}
/**
* Sets the isNull value for this CrmReference.
*
* @param isNull
*/
public void setIsNull( boolean isNull ) {
this.isNull = isNull;
}
/**
* Gets the name value for this CrmReference.
*
* @return name
*/
public java.lang.String getName() {
return name;
}
/**
* Sets the name value for this CrmReference.
*
* @param name
*/
public void setName( java.lang.String name ) {
this.name = name;
}
/**
* Gets the type value for this CrmReference.
*
* @return type
*/
public java.lang.String getType() {
return type;
}
/**
* Sets the type value for this CrmReference.
*
* @param type
*/
public void setType( java.lang.String type ) {
this.type = type;
}
/**
* Gets the dsc value for this CrmReference.
*
* @return dsc
*/
public int getDsc() {
return dsc;
}
/**
* Sets the dsc value for this CrmReference.
*
* @param dsc
*/
public void setDsc( int dsc ) {
this.dsc = dsc;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals( java.lang.Object obj ) {
if( !( obj instanceof CrmReference ) ) return false;
CrmReference other = (CrmReference)obj;
if( obj == null ) return false;
if( this == obj ) return true;
if( __equalsCalc != null ) {
return ( __equalsCalc == obj );
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals( obj ) && this.isNull ==
other.isIsNull()
&& ( ( this.name == null &&
other.getName() == null ) || ( this.name != null && this.name.equals(
other.getName() ) ) )
&& ( ( this.type == null &&
other.getType() == null ) || ( this.type != null && this.type.equals(
other.getType() ) ) )
&& this.dsc == other.getDsc();
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if( __hashCodeCalc ) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
_hashCode += ( isIsNull() ? Boolean.TRUE : Boolean.FALSE
).hashCode();
if( getName() != null ) {
_hashCode += getName().hashCode();
}
if( getType() != null ) {
_hashCode += getType().hashCode();
}
_hashCode += getDsc();
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc( CrmReference.class, true );
static {
typeDesc.setXmlType( new javax.xml.namespace.QName( "
http://schemas.microsoft.com/crm/2006/WebServices", "CrmReference" ) );
org.apache.axis.description.AttributeDesc attrField = new
org.apache.axis.description.AttributeDesc();
attrField.setFieldName( "isNull" );
attrField.setXmlName( new javax.xml.namespace.QName( "",
"IsNull" ) );
attrField.setXmlType( new javax.xml.namespace.QName( "
http://www.w3.org/2001/XMLSchema", "boolean" ) );
typeDesc.addFieldDesc( attrField );
attrField = new
org.apache.axis.description.AttributeDesc();
attrField.setFieldName( "name" );
attrField.setXmlName( new javax.xml.namespace.QName( "",
"name" ) );
attrField.setXmlType( new javax.xml.namespace.QName( "
http://www.w3.org/2001/XMLSchema", "string" ) );
typeDesc.addFieldDesc( attrField );
attrField = new
org.apache.axis.description.AttributeDesc();
attrField.setFieldName( "type" );
attrField.setXmlName( new javax.xml.namespace.QName( "",
"type" ) );
attrField.setXmlType( new javax.xml.namespace.QName( "
http://www.w3.org/2001/XMLSchema", "string" ) );
typeDesc.addFieldDesc( attrField );
attrField = new
org.apache.axis.description.AttributeDesc();
attrField.setFieldName( "dsc" );
attrField.setXmlName( new javax.xml.namespace.QName( "",
"dsc" ) );
attrField.setXmlType( new javax.xml.namespace.QName( "
http://www.w3.org/2001/XMLSchema", "int" ) );
typeDesc.addFieldDesc( attrField );
}
/**
* 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.SimpleSerializer(
_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.SimpleDeserializer( _javaType, _xmlType,
typeDesc );
}
}
And this is the snippet that creates a new service call:
// create a new contact
Customer customer = new Customer(
account.getAccountid().getValue().getValue() );
customer.setType( EntityName.account.getValue() );
contact = new Contact();
contact.setFirstname( "Firstname" );
contact.setLastname( "Lastname" );
contact.setParentcustomerid( customer );
contact.setContactid( new Key( service.create( contact ) ) );
The "account.getAccountid().getValue().getValue()" contains
{3FEDE875-8731-DE1A-9464-005056EE7863} but the SOAP call looks like this.
Problem is with the value of ns1:parentcustomerid which should contain
{3FEDE875-8731-DE1A-9464-005056EE7863}.
<?xml version="1.0" encoding="UTF-8"?>
<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:Header>
<CrmAuthenticationToken soapenv:actor="
http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0"
xmlns="http://schemas.microsoft.com/crm/2007/WebServices">
<AuthenticationType xmlns="
http://schemas.microsoft.com/crm/2007/CoreTypes">0</AuthenticationType>
<OrganizationName xmlns="
http://schemas.microsoft.com/crm/2007/CoreTypes">org</OrganizationName>
<CallerId xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes
">00000000-0000-0000-0000-000000000000</CallerId>
</CrmAuthenticationToken>
</soapenv:Header>
<soapenv:Body>
<Create xmlns="http://schemas.microsoft.com/crm/2007/WebServices">
<entity xsi:type="ns1:contact" xmlns:ns1="
http://schemas.microsoft.com/crm/2007/WebServices">
<ns1:firstname xsi:type="xsd:string">Firstname</ns1:firstname>
<ns1:lastname xsi:type="xsd:string">Lastname</ns1:lastname>
<ns1:parentcustomerid dsc="0" type="account" IsNull="false"
xsi:type="ns2:Customer" xmlns:ns2="
http://schemas.microsoft.com/crm/2006/WebServices
">com.microsoft.schemas.crm._2006.webservices.custo...@1</ns1:parentcustomerid>
</entity>
</Create>
</soapenv:Body>
</soapenv:Envelope>
Can someone please explain what am I doing wrong, of if it is not my bug,
how to work around it?
Thank in advance and best regards,
---
Miha Vitorovic
Inženir v tehničnem področju
Customer Support Engineer
NIL Data Communications, Tivolska cesta 48, 1000 Ljubljana, Slovenia
Phone +386 1 4746 500 Fax +386 1 4746 501 http://www.NIL.si