Clint,

If you had any Idea how happy I am right now....-) A great thanks to you is
definitely due.-) 

There seem to be a great difference (at least for axis) whether you define
types "embedded" inside of elements, or as separate types. 

I'm going to elaborate this a bit, just in case someone comes along later
with the same problem .-)

The user documentation for the .wsdl that was provided for me used an
embedded approach. The document suggested I'd do something like this;

<xs:element name="CreateUserAttributes" ns:CreateMODefinition">
   <xs:complexType>
     <xs:complexContent>
     <xs:extension base="ns:AbstractCreateAttributeType">       
       <xs:sequence>
                                ...
        </xs:sequence>
        </xs:extension>
     </xs:complexType>
</xs:element>

This causes Axis to serialize an xml with no xsi:type attribute, probably,
as you said, because it has no name for the embedded type for it's symbol
tables. 

Declaring this as a type, on the top level, and maybe declaring an element
of this type, instead, makes a whole lot of difference .-)

<xs:complexType name="CreateUserAttributesType">
  <xs:complexContent>
    <xs:extension base="ns:AbstractCreateAttributeType">        
    <xs:sequence>
                ...
    </xs:sequence>
  </xs:extension>
</xs:complexType>

<xs:element name=CreateUserAttributes" type="CreateUserAttributesType"
 

-----Original Message-----
From: Dovholuk, Clint [mailto:[EMAIL PROTECTED] 
Sent: 5. oktober 2005 14:44
To: axis-user@ws.apache.org
Subject: RE: Missing xsi:type attribute on abstract element

try updating your wsdl...  though axis processed the wsdl, the web
service studio tool I referred to does not... generally that indicates
some kind of 'error' with your wsdl.. Also, axis won't generate classes
for types that aren't "used"... by embedding the complex type that
extends the abstract as below, the complextype doesn't get a name, thus
axis doesn't generate a class for it... (I think that's how axis works).
I am certainly not proficient with all the nuisances with wsdl, but give
this a go and see if it works for you... Seemed to work for me...

change your schema to:
        <xs:schema xmlns="http://www.webstep.no/schemas/";
targetNamespace="http://www.webstep.no/schemas/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
            <xs:element name="Request" type="xs:string" />
            <xs:element name="GetResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="numberOfItemsInStore"
type="xs:int"/>
                        <xs:element name="ItemAttributes"
type="AbstractGetAttributeType" minOccurs="0"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <!-- Abstract schema elements -->
            <xs:complexType name="AbstractGetAttributeType"
abstract="true"/>

            <!-- Concrete schema elements -->
            <xs:complexType name="GetComputerPartItemResponse">
              <xs:complexContent>
                <xs:extension base="AbstractGetAttributeType" >
                    <xs:sequence>
                        <xs:element name="partName" type="xs:string"/>
                        <xs:element name="partLocation"
type="xs:string"/>
                        <xs:element name="partDescription"
type="xs:string"/>
                    </xs:sequence>
                </xs:extension>
              </xs:complexContent>
            </xs:complexType>
        </xs:schema>

and then use that element in your message, such as:
    <message name="Request">
        <part name="pk" element="webstep:Request" />
    </message>


 

-----Original Message-----
From: glenn bech [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 05, 2005 7:41 AM
To: axis-user@ws.apache.org
Subject: RE: Missing xsi:type attribute on abstract element

Hi again Clint,

The WSDL files are specified with the wsdlfile property, and they are
all hand made (you can see the wsdl at the bottom of my original post).

... I'm just curious now on why Axis is not including the xsi:type="" on
my abstract element...

 
-----Original Message-----
From: Dovholuk, Clint [mailto:[EMAIL PROTECTED]
Sent: 5. oktober 2005 13:25
To: axis-user@ws.apache.org
Subject: RE: Missing xsi:type attribute on abstract element

are you generating both client and server code from one wsdl? or are you
creating server code from the wsdl, publishing the web service, then
using axis to consume the published wsdl? the best approach is to create
both the client code and the server code from a hand made wsdl.  axis'
generation of wsdl (while being nice) is pretty limited...

also verify that whatever type should be in the xsi:type="" portion is
actually in your server-config.wsdd (if you're not using the
adminclient)

I personally have gone entirely away from allowing axis to generate a
wsdl, instead I specify the file that axis should server using the
<wsdlFile> property to where the 'actual' wsdl is published - that
alleviates a lot of confusion with axis...




-----Original Message-----
From: glenn bech [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 05, 2005 5:05 AM
To: axis-user@ws.apache.org
Subject: Missing xsi:type attribute on abstract element

Hi, I process the following .wsdl file with support for wrapped
document/literal off. 

After deployment, I write a dummy implementation of  the SDI, and test
my stub against the server. 

The *response* looks like this ; 

<?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:Body>
        <GetResponse xmlns="http://www.webstep.no/schemas/";>
            <numberOfItemsInStore xmlns="">100</numberOfItemsInStore>
            <ItemAttributes xmlns="">
                <partName>10300404</partName>
                <partLocation>Oslo</partLocation>
                <partDescription>CPU. P-120MHZ</partDescription>
            </ItemAttributes>
        </GetResponse>
    </soapenv:Body>


Aa you can see, my abstract element "ItemAttributes" have no xsi:type
attribute, and the BeanDeSerializer has no Idea what concreate
implementation of this class to instantiate.

Any Idea if I can "force" the "xsi:type" attribute, or any Idea why this
is not included ?

Im not sure if the problem is related, but when I take a look at the
WSDL that axis generates for my service. My derived class is missing. 

- The Exception 

- Exception:
org.xml.sax.SAXException: Invalid element in
no.webstep.www.schemas.AbstractGetAttributeType - partName
        at
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeseriali
zer.
java:258)
        at
org.apache.axis.encoding.DeserializationContext.startElement(Deserializa
tion
Context.java:1035)
        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:
165)
        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.j
ava:
1141)
        at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
        at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
        at org.apache.axis.client.Call.invoke(Call.java:2448)
        at org.apache.axis.client.Call.invoke(Call.java:2347)
        at org.apache.axis.client.Call.invoke(Call.java:1804)
        at
no.webstep.www.schemas.ItemStorageStub.get(ItemStorageStub.java:178)
        at TestAbstractNess.main(TestAbstractNess.java:27)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)


- The test code that fails 

URL urlWsdl = new
URL("http://localhost:8888/axis/abstracttest-alternate.wsdl";);
String nameSpaceUri = "http://www.webstep.no/schemas/";; String
serviceName = "AbstractTest";

ServiceFactory serviceFactory = ServiceFactory.newInstance(); Service
service = serviceFactory.createService(urlWsdl, new QName(nameSpaceUri,
serviceName)); ItemStorageStub stub = new ItemStorageStub(new
URL("http://localhost:8888/axis/services/ItemStorage";), service) ;
System.out.println(stub.get("010223232-S" ).getNumberOfItemsInStore()) ;


- Sever side implementation 

public class ItemStorageImpl implements
no.webstep.www.schemas.ItemStorage{
    public no.webstep.www.schemas.GetResponse get(java.lang.String pk)
throws java.rmi.RemoteException {
        return new GetResponse(10000, new GetResponseAttributes(new
GetComputerPartItemResponse("CPU", "Oslo", "Central Processing Unit")))
; 
    }

}


- The generated class for my derived type

/**
 * GetComputerPartItemResponse.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java
emitter.
 */

package no.webstep.www.schemas;

public class GetComputerPartItemResponse  extends
no.webstep.www.schemas.AbstractGetAttributeType  implements
java.io.Serializable {
    private java.lang.String partName;
    private java.lang.String partLocation;
    private java.lang.String partDescription;

    public GetComputerPartItemResponse() {
    }

    public GetComputerPartItemResponse(
           java.lang.String partName,
           java.lang.String partLocation,
           java.lang.String partDescription) {
           this.partName = partName;
           this.partLocation = partLocation;
           this.partDescription = partDescription;
    }


    /**
     * Gets the partName value for this GetComputerPartItemResponse.
     * 
     * @return partName
     */
    public java.lang.String getPartName() {
        return partName;
    }


    /**
     * Sets the partName value for this GetComputerPartItemResponse.
     * 
     * @param partName
     */
    public void setPartName(java.lang.String partName) {
        this.partName = partName;
    }


    /**
     * Gets the partLocation value for this GetComputerPartItemResponse.
     * 
     * @return partLocation
     */
    public java.lang.String getPartLocation() {
        return partLocation;
    }


    /**
     * Sets the partLocation value for this GetComputerPartItemResponse.
     * 
     * @param partLocation
     */
    public void setPartLocation(java.lang.String partLocation) {
        this.partLocation = partLocation;
    }


    /**
     * Gets the partDescription value for this
GetComputerPartItemResponse.
     * 
     * @return partDescription
     */
    public java.lang.String getPartDescription() {
        return partDescription;
    }


    /**
     * Sets the partDescription value for this
GetComputerPartItemResponse.
     * 
     * @param partDescription
     */
    public void setPartDescription(java.lang.String partDescription) {
        this.partDescription = partDescription;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof GetComputerPartItemResponse)) return false;
        GetComputerPartItemResponse other =
(GetComputerPartItemResponse) 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.partName==null && other.getPartName()==null) || 
             (this.partName!=null &&
              this.partName.equals(other.getPartName()))) &&
            ((this.partLocation==null && other.getPartLocation()==null)
|| 
             (this.partLocation!=null &&
              this.partLocation.equals(other.getPartLocation()))) &&
            ((this.partDescription==null &&
other.getPartDescription()==null) || 
             (this.partDescription!=null &&
              this.partDescription.equals(other.getPartDescription())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = super.hashCode();
        if (getPartName() != null) {
            _hashCode += getPartName().hashCode();
        }
        if (getPartLocation() != null) {
            _hashCode += getPartLocation().hashCode();
        }
        if (getPartDescription() != null) {
            _hashCode += getPartDescription().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new
org.apache.axis.description.TypeDesc(GetComputerPartItemResponse.class,
true);

    static {
        typeDesc.setXmlType(new
javax.xml.namespace.QName("http://www.webstep.no/schemas/";,
">GetComputerPartItemResponse"));
        org.apache.axis.description.ElementDesc elemField = new
org.apache.axis.description.ElementDesc();
        elemField.setFieldName("partName");
        elemField.setXmlName(new javax.xml.namespace.QName("",
"partName"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema";,
"string"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("partLocation");
        elemField.setXmlName(new javax.xml.namespace.QName("",
"partLocation"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema";,
"string"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("partDescription");
        elemField.setXmlName(new javax.xml.namespace.QName("",
"partDescription"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema";,
"string"));
        elemField.setNillable(false);
        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);
    }

}

- The Schema


<definitions
    xmlns="http://schemas.xmlsoap.org/wsdl/";
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
    xmlns:webstep="http://www.webstep.no/schemas/";
    targetNamespace="http://www.webstep.no/schemas/";>

    <types>
        <xs:schema xmlns="http://www.webstep.no/schemas/";
targetNamespace="http://www.webstep.no/schemas/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
            <!-- Abstract schema eleemnts -->

            <xs:element name="GetResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="numberOfItemsInStore"
type="xs:int"/>
                        <xs:elemsent name="ItemAttributes"
type="AbstractGetAttributeType" minOccurs="0"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <xs:complexType name="AbstractGetAttributeType"
abstract="true"/>

            <!-- Concrete schema elements -->

            <xs:element name="GetComputerPartItemResponse">
                <xs:complexType>
                    <xs:complexContent>
                        <xs:extension base="AbstractGetAttributeType" >
                            <xs:sequence>
                                <xs:element name="partName"
type="xs:string"/>
                                <xs:element name="partLocation"
type="xs:string"/>
                                <xs:element name="partDescription"
type="xs:string"/>
                            </xs:sequence>
                        </xs:extension>
                    </xs:complexContent>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </types>

    <message name="Request">
        <part name="pk" type="xs:string"/>
    </message>

    <message name="Response">
        <part name="result" element="webstep:GetResponse"/>
    </message>

    <portType name="ItemStorage">
        <operation name="Get">
            <input message="webstep:Request"/>
            <output message="webstep:Response"/>
        </operation>
    </portType>

    <binding name="ItemStorage" type="webstep:ItemStorage">
        <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="Get">
            <soap:operation soapAction="CAI3G#Get" style="document" />
            <input>
                    <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
    </binding>

    <service name="AbstractTest">
        <port name="ItemStorage" binding="webstep:ItemStorage">
            <soap:address
location="http://anyema.anyprovisioningprovider.com/cai3g"/>
        </port>
    </service>

</definitions>

 




Glenn Richard Bech
Seniorkonsulent
Mob: 99356459 Tel: 40003325
Lysaker torg 2,  1366 Lysaker
http://www.webstep.no
Bergen - Oslo - Stavanger
 
 
-----Original Message-----
From: Clement Lyons [mailto:[EMAIL PROTECTED]
Sent: 5. oktober 2005 04:46
To: axis-user@ws.apache.org
Subject: Configure Axis WS client to use HTTP/1.1

Hi 

I'am relatively new to Axis.
I need to configure my axis Client to use HTTP/1.1 instead of HTTP/1.0.

I've searched this List and the Web but cannot find any description on
how to do this.

Can anyone point me in the correct direction here ?

Thanks

Clement





Reply via email to