aspose file tools*
The moose likes Web Services and the fly likes WSDL generated with AnyType,Unable to consume Web service of AnyType Element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WSDL generated with AnyType,Unable to consume Web service of AnyType Element" Watch "WSDL generated with AnyType,Unable to consume Web service of AnyType Element" New topic
Author

WSDL generated with AnyType,Unable to consume Web service of AnyType Element

praneeth gajji
Greenhorn

Joined: Apr 12, 2012
Posts: 24
Hi, I have created a bottom up web service for which WSDl type is generated as AnyType when I provide web service return type as OMElement .Web service is processing properly and generating me soapenvelope but while consuming the web service I am getting exception AnyType element not given..
Is there a way we can convert Axiom Element into any object array or any other way to convert Axiom element so that it will generate proper WSDL.Here I am using services to generate web service skeleton. I am stucked here from long back unable to resolve .I dont have any one to help me out here .

Here I dont have acces to edit my WSDL only through URL I can acces my WSDL.

Please help me to resolve the issue.Thanks to all in Advance..

Below is the WSDL generated

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://nearestCollectionCenterWeb.gssexample.com" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://nearestCollectionCenterWeb.gssexample.com">
<wsdl:documentation>NearestCollectionCentreWebService</wsdl:documentation>
- <wsdl:types>
- <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://nearestCollectionCenterWeb.gssexample.com">
- <xs:complexType name="Exception">
- <xs:sequence>
<xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
- <xs:element name="getNearestCentre">
- <xs:complexType>
- <xs:sequence>
<xs:element minOccurs="0" name="srNumber" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="buffDist" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="centerTypes" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getNearestCentreResponse">
- <xs:complexType>
- <xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
- <wsdl:message name="getNearestCentreRequest">
<wsdl:part name="parameters" element="ns:getNearestCentre" />
</wsdl:message>
- <wsdl:message name="getNearestCentreResponse">
<wsdl:part name="parameters" element="ns:getNearestCentreResponse" />
</wsdl:message>
- <wsdl:portType name="NearestCollectionCentreWebServicePortType">
- <wsdlperation name="getNearestCentre">
<wsdl:input message="ns:getNearestCentreRequest" wsaw:Action="urn:getNearestCentre" />
<wsdlutput message="ns:getNearestCentreResponse" wsaw:Action="urn:getNearestCentreResponse" />
</wsdlperation>
</wsdl:portType>
- <wsdl:binding name="NearestCollectionCentreWebServiceSoap11Binding" type="ns:NearestCollectionCentreWebServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdlperation name="getNearestCentre">
<soapperation soapAction="urn:getNearestCentre" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdlutput>
<soap:body use="literal" />
</wsdlutput>
</wsdlperation>
</wsdl:binding>
- <wsdl:binding name="NearestCollectionCentreWebServiceSoap12Binding" type="ns:NearestCollectionCentreWebServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdlperation name="getNearestCentre">
<soap12peration soapAction="urn:getNearestCentre" style="document" />
- <wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
- <wsdlutput>
<soap12:body use="literal" />
</wsdlutput>
</wsdlperation>
</wsdl:binding>
- <wsdl:binding name="NearestCollectionCentreWebServiceHttpBinding" type="ns:NearestCollectionCentreWebServicePortType">
<http:binding verb="POST" />
- <wsdlperation name="getNearestCentre">
<httpperation location="NearestCollectionCentreWebService/getNearestCentre" />
- <wsdl:input>
<mime:content type="text/xml" part="getNearestCentre" />
</wsdl:input>
- <wsdlutput>
<mime:content type="text/xml" part="getNearestCentre" />
</wsdlutput>
</wsdlperation>
</wsdl:binding>
- <wsdl:service name="NearestCollectionCentreWebService">
- <wsdl:port name="NearestCollectionCentreWebServiceHttpSoap11Endpoint" binding="ns:NearestCollectionCentreWebServiceSoap11Binding">
<soap:address location="http://172.16.211.4:8080/gss/web/services/NearestCollectionCentreWebService.NearestCollectionCentreWebServiceHttpSoap11Endpoint/" />
</wsdl:port>
- <wsdl:port name="NearestCollectionCentreWebServiceHttpSoap12Endpoint" binding="ns:NearestCollectionCentreWebServiceSoap12Binding">
<soap12:address location="http://172.16.211.4:8080/gss/web/services/NearestCollectionCentreWebService.NearestCollectionCentreWebServiceHttpSoap12Endpoint/" />
</wsdl:port>
- <wsdl:port name="NearestCollectionCentreWebServiceHttpEndpoint" binding="ns:NearestCollectionCentreWebServiceHttpBinding">
<http:address location="http://172.16.211.4:8080/gss/web/services/NearestCollectionCentreWebService.NearestCollectionCentreWebServiceHttpEndpoint/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 608
Suppose you have set Java_Home environment variable to where JDK is installed. And supposed your WSDL provided is saved in the current directory under the name myWsdl.wsdl

On the command prompt , type:
wsimport -keep -p myClient myWsdl.wsdl

After that , you will see myClient package in your working directory. Then, you will see AnyType element.
praneeth gajji
Greenhorn

Joined: Apr 12, 2012
Posts: 24
Thanks for your reply Himai Minh.

But my question is I am unable to consume web service if return type inside wsdl is AnyType.For the wsdl skeleton code is returning OMElement for which consuming is not happening properly if we provide any hashmap or list as return.

Is there a way to convert this Axiom Element to any string array.. Sample code of web serviceskeleton from which Anytype is generated I am providing here
public OMElement getNearestCentre (
java.lang.String srNumber,
java.lang.String buffDist,
java.lang.String centerTypes) throws AxisFault {

Map<String,Object> params = new HashMap<String,Object>();
params.put("srNumber", srNumber);
params.put("buffDist", buffDist);
params.put("centerTypes", centerTypes);
if(buffDist != null && !"".equals(buffDist)){
params.put("buffDist", buffDist);
}else{
buffDist = null;
params.put("buffDist", buffDist);
}
if(!"".equals(centerTypes) && centerTypes != null){
params.put("centerTypes", centerTypes);
}else{
params.put("centerTypes", "All");
}
return makeAxiomRequest(ejbServiceName, "getNearestCentre", params);

Here return type is OMElement can I convert this OMElement to object[] which can be consumed properly

Please help..Thanks in Advance
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 608
So, if OEMElement is the expected return, how about this:
praneeth gajji
Greenhorn

Joined: Apr 12, 2012
Posts: 24
Thanks Himah for your reply,I will try n the one you proposed and get back to you
praneeth gajji
Greenhorn

Joined: Apr 12, 2012
Posts: 24
Hi Himah, I have tried typecasting OMELEMENT to object array which is not happening ,getting compilation /runtime errors

OMElement oe = makeAxiomRequest(ejbServiceName, "getCustomers", params);
Object[] o = oe;

WHere we cant type caste OMELEMENT to object array here and code shown above generates me OMELEMNT return type.
Please suggest.
Thanks in Advance..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSDL generated with AnyType,Unable to consume Web service of AnyType Element
 
Similar Threads
XMLSpy won't work with our AXIS2 WSDL but our system works with it fine
Axis2 Issue, Please Help!
complextype with Axis2
Help needed in calling a Web service
XmlException on calling WSDL2Java