axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clifton B. Sothoron Jr." <Clifton.Sothoro...@LogiXML.com>
Subject First Element must contain the local name, Envelope , but found definitions
Date Thu, 02 Apr 2009 01:34:13 GMT
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");

        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/ndf
dXML.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 <mailto:kelly@logixml.com>  |
http://www.logixml.com <blocked::blocked::http://www.logixml.com/> 

 


Mime
View raw message