axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Suriarachchi <amilasuriarach...@gmail.com>
Subject Re: First Element must contain the local name, Envelope , but found definitions
Date Thu, 02 Apr 2009 05:39:52 GMT
On Thu, Apr 2, 2009 at 7:04 AM, Clifton B. Sothoron Jr. <
Clifton.SothoronJr@logixml.com> wrote:

>  I’m testing a dynamic client Axis 2 application. It works fine except
> that one web service I’m testing with is giving me a problem. The
> ServiceClient.sendReceive invocation generates the message “*First Element
> must contain the local name, Envelope , but found definitions*”.  The URL
> is http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl. I’ve
> looked at the returned XML via a sniffer and it indeed has definitions in
> it.  Obviously I can’t change the server side. Is there a way around this
> using Axis 2 in a dynamic client?  The following code illustrates the
> problem.
>
>
>
> import org.apache.axiom.om.OMAbstractFactory;
>
> import org.apache.axiom.om.OMElement;
>
> import org.apache.axiom.om.OMFactory;
>
> import org.apache.axis2.Constants;
>
> import org.apache.axiom.om.OMNamespace;
>
> import org.apache.axis2.AxisFault;
>
> import org.apache.axis2.addressing.EndpointReference;
>
> import org.apache.axis2.client.Options;
>
> import org.apache.axis2.client.ServiceClient;
>
>
>
>
>
> public class Forecasts{
>
>         private static EndpointReference targetEPR = new EndpointReference(
>
>                         "
> http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl");
>

looks like you point to a wsdl file instead of service.

thanks,
Amila.

>         public static void main(String[] args) {
>
>                 try {
>
>
>
>                         ServiceClient client = new ServiceClient();
>
>                         OMFactory fac = OMAbstractFactory.getOMFactory();
>
>                         OMNamespace ns = fac.createOMNamespace("
> http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl",
>
> "tns");
>
>
>
>                                     OMElement payload =
> fac.createOMElement("LatLonListZipCode", ns);
>
>                         OMElement value = fac.createOMElement("ZipCode",
> ns);
>
>                         value.setText("22102");
>
>                                     payload.addChild(value);
>
>
>
>                         Options options = new Options();
>
>
> options.setTimeOutInMilliSeconds(60000);
>
>
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>
>                                     options.setTo(targetEPR);
>
>                                     options.setAction("
> http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl/LatLonListZipCode
> ");
>
>                                     client.setOptions(options);
>
>                         //Blocking invocation
>
>
>
>                         OMElement result = client.sendReceive(payload);
>
>
>
>                         System.out.println(result.toString());
>
>
>
>                 } catch (AxisFault axisFault) {
>
>                         axisFault.printStackTrace();
>
>                 }
>
>
>
>         }
>
> }
>
>
>
>
>
> Thanks in advance,
>
> Clifton Sothoron
>
> LogiXML, Development Department
> 7900 Westpark Drive, Suite T107 |  McLean, VA 22102
> (703) 752-9700  Ext. 162 | fax: (703) 773-6903
> Clifton.SothoronJr@logixml.com <kelly@logixml.com> |
> http://www.logixml.com
>
>
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Mime
View raw message