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 Clement Lyons <Cl...@comindico.com.au> on 2005/10/05 04:45:47 UTC
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
SV: Configure Axis WS client to use HTTP/1.1
Posted by Rickard Svensson <sr...@home.se>.
Hello Clement,
depending on the axis version being used, try:
// For older Axis versions, for example 1.0:
call.setScopedProperty(MessageContext.HTTP_TRANSPORT_VERSION,HTTPConstants.H
EADER_PROTOCOL_V11);
or:
// For new Axis versions, for example 1.2.1:
call.setProperty(MessageContext.HTTP_TRANSPORT_VERSION,HTTPConstants.HEADER_
PROTOCOL_V11);
/Best regards
Rickard S
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
Missing xsi:type attribute on abstract element
Posted by glenn bech <gl...@webstep.no>.
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(BeanDeserializer.
java:258)
at
org.apache.axis.encoding.DeserializationContext.startElement(Deserialization
Context.java:1035)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
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.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.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:Clement.Lyons@comindico.com.au]
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