• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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">
- <wsdl:operation name="getNearestCentre">
<wsdl:input message="ns:getNearestCentreRequest" wsaw:Action="urn:getNearestCentre" />
<wsdl:output message="ns:getNearestCentreResponse" wsaw:Action="urn:getNearestCentreResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="NearestCollectionCentreWebServiceSoap11Binding" type="ns:NearestCollectionCentreWebServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="getNearestCentre">
<soap:operation soapAction="urn:getNearestCentre" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:binding name="NearestCollectionCentreWebServiceSoap12Binding" type="ns:NearestCollectionCentreWebServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="getNearestCentre">
<soap12:operation soapAction="urn:getNearestCentre" style="document" />
- <wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:binding name="NearestCollectionCentreWebServiceHttpBinding" type="ns:NearestCollectionCentreWebServicePortType">
<http:binding verb="POST" />
- <wsdl:operation name="getNearestCentre">
<http:operation location="NearestCollectionCentreWebService/getNearestCentre" />
- <wsdl:input>
<mime:content type="text/xml" part="getNearestCentre" />
</wsdl:input>
- <wsdl:output>
<mime:content type="text/xml" part="getNearestCentre" />
</wsdl:output>
</wsdl:operation>
</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>
 
Bartender
Posts: 2445
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2445
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, if OEMElement is the expected return, how about this:
 
praneeth gajji
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Himah for your reply,I will try n the one you proposed and get back to you
 
praneeth gajji
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic