M,
 
The code that I am pasting does work. I had to restart from scratch was able to successfully create the soap wrapper/header correctly.  But I do have an oustanding issue that I have annotated in a previous email regarding the ServiceClient.sendRecieve() method.  I've attached the email to which I am having the problem.  I'm waiting on a response from the user-group.  Thanks for following up on this.
 
  // create the parser
  XMLStreamReader parser = XMLInputFactory.newInstance()
    .createXMLStreamReader(new FileInputStream(file));
 
  // create the builder
  StAXOMBuilder builder = new StAXOMBuilder(parser);
 
  // get the root element (in this case the envelope)
  OMElement documentElement = builder.getDocumentElement();
  SOAPFactory omfactory;
  if (soapVersion.equals("1.2")) {
   omfactory = OMAbstractFactory.getSOAP12Factory();
   log.debug("Setting up SOAP1.2 message........");
  } else {
   omfactory = OMAbstractFactory.getSOAP11Factory();
   log.debug("Setting up SOAP1.1 message........");
  }
  SOAPEnvelope envelope = omfactory.createSOAPEnvelope();
  OMElement action = "" namespace, "");
  SOAPBody body = omfactory.createSOAPBody(envelope);
  action.addChild(documentElement);
  body.addChild(action)
John

>>> [EMAIL PROTECTED] 07/06/06 3:22 PM >>>
Good Afternoon John-

AXIS 2 is decidedly not beta ready
The functionality I had with Axis-1_3 (which worked flawlessly BTW) is either
Missing entirely..Is there one working jws which the AxisServlet will publish as a working AxisServlet service?
Doesnt work at all ..try running WSDL2Java on any WSDL in the samples folder and watch the fireworks
Last..Maven is a great tool for build engineers but I prefer Ant

Comments?

M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.
 

 
----- Original Message -----
Sent: Wednesday, July 05, 2006 6:01 PM
Subject: Re: Re: Converting from Glue to Axis2.0

Yes I did and the code that you recommended to me does work, but I have to manually then create the header, evelope, and body tags for the soap message. 
Some of the code that I was using was also from   http://ws.apache.org/axis2/1_0/OMTutorial.html which is talked about more at the very bottom of this email. 
 
John


>>> [EMAIL PROTECTED] 07/05/06 4:36 PM >>>
Hi John-
I dont know about your converter but personally  I didnt see anything that resembled the V1.x code that you generated
 
did you get a chance to take a look at the sample 2.x client code located at
samples/googleSpellcheck/src/sample/google/spellcheck/FormModel.java

M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.
 

 
----- Original Message -----
Sent: Wednesday, July 05, 2006 5:13 PM
Subject: Re: Re: Converting from Glue to Axis2.0

http://ws.apache.org/axis2/

>>> [EMAIL PROTECTED] 07/05/06 4:05 PM >>>
Ok - Where is Axis 2.0 located??
The latest version I can find at http://ws.apache.org/axis/ is V 1.4
Martin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.
 

 
----- Original Message -----
Sent: Wednesday, July 05, 2006 4:31 PM
Subject: Re: Re: Converting from Glue to Axis2.0

Martin,
 
The createName() method does not exist in the Axis 2.0 release, as least from what I can tell....I am using axis2.0 release 1.0
 
John

>>> [EMAIL PROTECTED] 07/05/06 3:05 PM >>>
The best way to handle this is to call the SOAPEnvelope.createNameto create a valid name and add that Child to the body-
 
try
{
Name name = envelope.createName("GetLastTradePrice", "WOMBAT",http://www.wombat.org/trader);
body.addChild(name);
}
catch(SOAPException excp)
{
//log the error here
}

take a look at this declaration
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.
 

 
----- Original Message -----
Sent: Wednesday, July 05, 2006 3:46 PM
Subject: Fwd: Re: Converting from Glue to Axis2.0

Does anyone have an answer to the follow question??/

>>> [EMAIL PROTECTED] 07/05/06 10:31 AM >>>
Ajith,
 
With your sample code:
 
  XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(file));
  
  // create the builder
  StAXOMBuilder builder = new StAXOMBuilder(parser);
  
  // get the root element (in this case the envelope)
  OMElement documentElement = builder.getDocumentElement();
  SOAP11Factory factory = new SOAP11Factory();
  SOAPEnvelope envelope = factory.getDefaultEnvelope();
  SOAPBody body = factory.createSOAPBody(envelope);
  body.addChild(documentElement);
 
The add child method throws a class cast exception, am I missing something?
 
John
 
 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hi,
You can just create an OMElement out of the string and attach that to
a default SOAP envelope.

1. use the staxOMBuilder to parse the file and generate an OMElement out of it.
see [1]
2. Use the SOAPxxFactory.getDefaultEnvelope() to get an envelope
object. Use the getBody().addChild(xxx) method to attach the
OMElement.

That should do the trick :)

Ajith
[1] http://ws.apache.org/axis2/1_0/OMTutorial.html


On 7/4/06, John Ferron <[EMAIL PROTECTED]> wrote:
>
>
> All,
>
> I'm trying to converting a web-based publishing util from Glue to Axis 2.0
> and what I am trying to do (which I have found lacking in the samples from
> the install), is a example of how to add a standard soap header to an XML
> document.  (Yes, I'm a slight newbie).  What I am trying to accomplish is
> the have the operability to be able to use SOAP 1.1 or SOAP 1.2.  All I'm
> trying to do is to read in a XML doc (which is done via commons-upload) and
> wrap that with a standard SOAP envelope/header.  I have tried experimenting
> with the SOAP11Factory, and the SOAP12Factory, but could not get the xml
> document to load correctly in the soap document.
>
> For example (Here is the soap header I'm trying to add):
>
> <?xml version='1.0' encoding='UTF-8'?>
>   <soap:Envelope
> xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
>     <soap:Body>
>       <myOperation
> xmlns='http://www.themindelectric.com/wsdl/virtual/'>
>         <myXMLDocument>
>          
>          
>          
>           .
>         </myXMLDocument>
>       </myOperation>
>     </soap:Body>
>   </soap:Envelope>
>
> myOperation refers to a operation is a WSDL file that we will be publishing
> to.  I am NOT trying to bind this to a specifc WSDL, (so I'm assuming I do
> not need to perform the whole WSDL2Java operation).  If anyone could help me
> out, that would be greatly appreciated.
>
> John


--
Ajith Ranabahu

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--- Begin Message ---
Ajith
 
Based off the stack trace (which I did forget in the previous email), no, it is on sending:
 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:223)
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:589)
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:328)
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:279)
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:457)
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:399)
com.alliantenergy.soap.SoapClient.sendRecieve(SoapClient.java:135)
com.alliantenergy.soap.SoapClient.parseXMLMessage(SoapClient.java:90)
com.alliantenergy.soap.SoapClient.postSoapMessage(SoapClient.java:41)
org.apache.jsp.ProcessSOAPMessage_jsp._jspService(ProcessSOAPMessage_jsp.java:139)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
java.lang.Thread.run(Thread.java:536)
John
>>> [EMAIL PROTECTED] 07/06/06 10:44 AM >>>
A quick clarification!
Does the problem occur after receiving a response ?

Ajith

On 7/6/06, John Ferron <[EMAIL PROTECTED]> wrote:
>
>
> All,
>
> I'm getting the following nested exception:
>
>  Can not output XML declaration, after other output has already been done.;
> nested exception is:
>         javax.xml.stream.XMLStreamException: Can not output
> XML declaration, after other output has already been done.; nested exception
> is:
>         org.apache.axis2.AxisFault: Can not output XML declaration, after
> other output has already been done.; nested exception is:
>         javax.xml.stream.XMLStreamException: Can not output
> XML declaration, after other output has already been done.; nested exception
> is:
>         org.apache.axis2.AxisFault: Can not output XML declaration, after
> other output has already been done.; nested exception is:
>         javax.xml.stream.XMLStreamException: Can not output
> XML declaration, after other output has already been done.; nested exception
> is:
>         org.apache.axis2.AxisFault: Can not output XML declaration, after
> other output has already been done.; nested exception is:
>         javax.xml.stream.XMLStreamException: Can not output
> XML declaration, after other output has already been done.; nested exception
> is:
>         org.apache.axis2.AxisFault: Can not output XML declaration, after
> other output has already been done.; nested exception is:
>         javax.xml.stream.XMLStreamException: Can not output
> XML declaration, after other output has already been done.; nested exception
> is:
>         org.apache.axis2.AxisFault: Can not output XML declaration, after
> other output has already been done.; nested exception is:
>         javax.xml.stream.XMLStreamException: Can not output
> XML declaration, after other output has already been done.; nested exception
> is:
>         org.apache.axis2.AxisFault: Can not output XML declaration, after
> other output has already been done.; nested exception is:
>         javax.xml.stream.XMLStreamException: Can not output
> XML declaration, after other output has already been done.; nested exception
> is:
>         org.apache.axis2.AxisFault: Can not output XML declaration, after
> other output has already been done.; nested exception is:
>         javax.xml.stream.XMLStreamException: Can not output
> XML declaration, after other output has already been done.
>
> The following method that sends the data is as follows:  The request element
> that I am passing through to this method is the SOAP envelope which has the
> complete SOAP message that I want to send.
>
> private void sendRecieve(String urlStr, OMElement requestElement) throws
> Exception {
>   URL url = "">>   OMElement responseElement = null;
>   try {
>    url = "" URL(urlStr);
>    log.info("URL: " + urlStr);
>   } catch (MalformedURLException e) {
>    StringFunctions.exceptionToString(e);
>   }
>
>   Options options = new Options();
>   options.setTo(new EndpointReference(url.toString()));
>   options.setProperty(MessageContextConstants.CHUNKED,
> Constants.VALUE_FALSE);
>
>   ServiceClient sender = new ServiceClient();
>   sender.setOptions(options);
>   log.info("Sending: ");
>   log.info(requestElement.toStringWithConsume());
>   responseElement = sender.sendReceive(requestElement);
>   if (responseElement == null) {
>    log.info("Null response");
>   } else {
>    log.info(responseElement.toStringWithConsume());
>   }
>  }
>
> Any help would be greatly appreciated
>
> John


--
Ajith Ranabahu

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--- End Message ---
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to