axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From WJ Krpelan <krpelan...@yahoo.com>
Subject Re: First Element must contain the local name, Envelope , but found definitions
Date Thu, 02 Apr 2009 13:47:39 GMT
Hi
you are right inasfar as that "wsdl" is not correct (invalid)
sorry no way to to dynamic webservices without valid wsdl-document
you could contact the source very well IMHO cause all other consumers will have the same problem
-
Cheers, Wolfgang

--- On Thu, 4/2/09, Clifton B. Sothoron Jr. <Clifton.SothoronJr@LogiXML.com> wrote:

From: Clifton B. Sothoron Jr. <Clifton.SothoronJr@LogiXML.com>
Subject: First Element must contain the local name, Envelope , but found definitions
To: axis-dev@ws.apache.org
Date: Thursday, April 2, 2009, 3:34 AM




 
 






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/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
| http://www.logixml.com 

   



 




      
Mime
View raw message