incubator-agila-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tngu...@symcor.com
Subject Re: get back the response message
Date Sun, 05 Feb 2006 20:41:44 GMT

Davide,

Now, I move one step forward, I can connect to Agila, but I got Axis
exception:
[Agila] ERROR [http-8080-Processor23] AxisServlet.getSoapAction(1002) |
Generati
ng fault class
AxisFault
 faultCode: {http://xml.apache.org/axis/}Client.NoSOAPAction
 faultSubcode:
 faultString: no SOAPAction header!
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:no SOAPAction header!
        at
org.apache.axis.transport.http.AxisServlet.getSoapAction(AxisServlet.
java:997)
        at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:67
6)
They say, they need the SOAPAction header!

My project is that I have to use bpel engine to invoke the webservice.  I
use Axis 1.1 to create the webservice and WSDL file.  Fronm this WSDL, I
manually create the wsdldef file and bpel file.  I enclose it in here.

And here is the code that I send the soap message:
 public SOAPMessage createSOAPMessage(ArrayList exceptionList) throws
SOAPException {

      MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPMessage message = messageFactory.createMessage();
        try {

       // SOAPFactory soapFactory = SOAPFactory.newInstance();

        SOAPMessageHandler soapMessageHandler = new SOAPMessageHandler();

        // ----------- Headers creation -------------
        //SOAPHeader header = message.getSOAPHeader();

        soapMessageHandler.createHeaderElement(message, "partner", "tws",
                   "http://www.apache.org/agila","exceptionservice");
        soapMessageHandler.createHeaderElement(message, "port", "tws",
                   "http://www.apache.org/agila","ExceptionService");
        soapMessageHandler.createHeaderElement(message, "operation", "tws",
                   "http://www.apache.org/agila","processExceptionItems");
        // ---------------------------------------------------

        SOAPBody body = message.getSOAPBody();

        SOAPElement proExMessageElement =
             soapMessageHandler.createIntermediateNode(body , "message",
                     "tn","http://www.symcor.com/tecp");

        SOAPElement exceptionListRequest =
            soapMessageHandler.createIntermediateNode(proExMessageElement,
"summaries");
        Iterator iterator = exceptionList.iterator();

        SearchResultSummary summary;
        SOAPElement itemSOAPElement;
        while (iterator.hasNext()) {
            summary = (SearchResultSummary)iterator.next();
            itemSOAPElement =
soapMessageHandler.createIntermediateNode(exceptionListRequest,
"SearchResultSummary");
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"account", summary.getAccount());
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"amount", String.valueOf(summary.getAmount()));
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"exceptionDate", String.valueOf(summary.getExceptionDate()));
            soapMessageHandler.createTextSOAPElement(itemSOAPElement, "fi",
summary.getFi());
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"mailTransit", summary.getMailTransit());
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"reasonCode", summary.getReasonCode());
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"sequence", summary.getSequence());
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"transitID", summary.getTransitID());
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"SLA", "");
            soapMessageHandler.createTextSOAPElement(itemSOAPElement,
"completionDate", "0");

        }

        message.saveChanges();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return message;
    }

       public ArrayList invokeExceptionService(ArrayList exceptionList)
throws WIRApplicationException{

      try {
            URL url = new
URL("http://localhost:8080/agila-ws/services/AgilaEngine");
            SOAPMessage sendMessage = createSOAPMessage (exceptionList);
            SOAPMessage returnMessage =
SOAPMessageHandler.sendSOAPMessage(sendMessage, url);


      } catch (Exception e){
            e.printStackTrace();
      }
            return exceptionList;
}

Please give me any suggestions?

Thanks
Tu(See attached file: ExceptionService.wsdl)(See attached file:
tecpbpel.bpel)(See attached file: tecpbpel.wsdl)




                                                                           
             Davide Ling                                                   
             <lingda@libero.it                                             
             >                                                          To 
                                       agila-user@incubator.apache.org     
             02/05/2006 03:07                                           cc 
             PM                                                            
                                                                   Subject 
                                       Re: get back the response message   
             Please respond to                                             
             agila-user@incuba                                             
              tor.apache.org                                               
                                                                           
                                                                           
                                                                           




On Sunday 05 February 2006 20:08, tnguyen@symcor.com wrote:
> Davidee,
>
> I try to send this soap message, but I got this exception:
> Feb 5, 2006 2:00:19 PM com.sun.xml.messaging.saaj.soap.MessageImpl
> saveChanges
> SEVERE: SAAJ0540: Error during saving a multipart message
> com.sun.xml.messaging.saaj.SOAPExceptionImpl: Error during saving a
> multipart me

Below is a simple client (non agila client) that send a messege like this:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
 <guy>
  <name>Davide</name>
  <surname>Ling</surname>
 </guy>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

And receive a message like this (from a servlet):
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
  <response>Hello Davide Ling</response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

import java.net.URL;

import javax.xml.soap.MessageFactory;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

public class Main {
             public static void main(String[] args) throws Exception {
                         SOAPFactory soapFactory =
SOAPFactory.newInstance();

                         MessageFactory mf = MessageFactory.newInstance();
                         SOAPMessage msg = mf.createMessage();
                         SOAPBody body = msg.getSOAPBody();
                         // You can detach the SOAP header in this example
                         // msg.getSOAPHeader().detachNode();

                         Name guyName = soapFactory.createName("guy");
                         SOAPElement guyElement =
body.addBodyElement(guyName);

                         SOAPElement child =
soapFactory.createElement("name");
                         child.addTextNode("Davide");
                         guyElement.addChildElement(child);

                         child = soapFactory.createElement("surname");
                         child.addTextNode("Ling");
                         guyElement.addChildElement(child);

                         msg.saveChanges();

                         // Create the connection
                         SOAPConnectionFactory scf =
                                     SOAPConnectionFactory.newInstance();
                                     SOAPConnection con =
scf.createConnection();

                         // Send the message
                         System.out.println("Send the SOAP message\n");
                         URL endpoint = new URL("
http://localhost:8080/SOAPServlet/SOAP");
                         SOAPMessage response = con.call(msg,endpoint);

                         // Print sent message
                         System.out.println("Sent:");
                         Transformer trans =
TransformerFactory.newInstance().newTransformer();
                         trans.transform(new
DOMSource(msg.getSOAPPart()),new
StreamResult(System.out));

                         // Print response message
                         System.out.println("\n\nReceived:");
                         trans.transform(new
DOMSource(response.getSOAPPart()),new
StreamResult(System.out));
             }
}

Bye
--
Davide Ling
Sito Personale - http://davideling.altervista.org
Key fingerprint = 284A 0FB9 F9F6 763C D429  E02B AA5D 483A 7E45 D2A6

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message