Package javax.xml.soap

Examples of javax.xml.soap.SOAPMessage


            out.println("\nOutbound message:");
        } else {
            out.println("\nInbound message:");
        }

        SOAPMessage message = smc.getMessage();
        try {
            message.writeTo(out);
            out.println();
        } catch (Exception e) {
            out.println("Exception in handler: " + e);
        }
View Full Code Here


        "<faultstring>Server did not recognize the value of HTTP Header SOAPAction: .</faultstring>"+
        "<detail/></soap:Fault></soap:Body></soap:Envelope>";

      java.io.InputStream is=new java.io.ByteArrayInputStream(str.getBytes());
     
      SOAPMessage soapMessage=javax.xml.soap.MessageFactory.newInstance().createMessage(null,
                is);
     
      is.close();
     
      javax.wsdl.factory.WSDLFactory fact=
View Full Code Here

        String str="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsdl=\"http://www.jboss.org/bpel/examples/wsdl\">"+
          "<soapenv:Header/><soapenv:Body><wsdl:hello><TestPart>Hello</TestPart></wsdl:hello></soapenv:Body></soapenv:Envelope>";

        java.io.InputStream is=new java.io.ByteArrayInputStream(str.getBytes());
       
        SOAPMessage soapReq1 = factory.createMessage(null, is);
       
        System.out.println("Invoking server through Dispatch interface using SOAPMessage");
        SOAPMessage soapResp = dispatcher.invoke(soapReq1);
       
        String result=soapResp.getSOAPBody().getTextContent();
       
        System.out.println("Response from server: " + result);

            return result.contains("Hello World");
        } catch (Exception ex) {
View Full Code Here

       
        String str="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsdl=\"http://www.jboss.org/bpel/examples/wsdl\">"+
            "<soapenv:Header/><soapenv:Body><wsdl:hello><TestPart>Hello</TestPart></wsdl:hello></soapenv:Body></soapenv:Envelope>";
        java.io.InputStream is=new java.io.ByteArrayInputStream(str.getBytes());
       
        SOAPMessage soapReq1 = factory.createMessage(null, is);
       
          System.out.println("Invoking server through Dispatch interface using SOAPMessage");
          SOAPMessage soapResp = dispatcher.invoke(soapReq1);
          System.out.println("Response from server: " + soapResp.getSOAPBody().getTextContent());
         
        System.exit(0);
    }
View Full Code Here

        //We need to get a new mex from persistence layer.
        PartnerRoleMessageExchange mex = (PartnerRoleMessageExchange) engine.getBpelServer().getEngine().getMessageExchange(mexId);
            try
            {
              // Create SOAPMessage
              SOAPMessage soapRequestMessage = MessageFactory.newInstance().createMessage();
              if(log.isDebugEnabled())
                log.debug( "ODE outbound message: \n" +DOMWriter.printNode(mex.getRequest().getMessage(), true) );
             
              String soapAction=messageAdapter.createSoapRequest(soapRequestMessage,
                      new ODEMessageAdapter(mex.getRequest()), mex.getOperation());
             
              if (log.isDebugEnabled()) {
                log.debug("Riftsaw soap request message: \n" + JavaUtils.getSoapMessageASString(soapRequestMessage));
              }
             
              org.apache.ode.bpel.iapi.EndpointReference odeepr=mex.getEndpointReference();
              javax.xml.ws.EndpointReference epr=null;
             
              if (odeepr != null) {
                if (odeepr instanceof org.apache.ode.bpel.epr.URLEndpoint) {
                  org.apache.ode.bpel.epr.URLEndpoint url=(org.apache.ode.bpel.epr.URLEndpoint)odeepr;
                 
                  javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder builder=
                        new javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder();
                 
                  epr = builder.address(url.getUrl())
                          .serviceName(serviceName)
                          .endpointName(port)
                          .build();
                 
                  if (log.isDebugEnabled()) {
                    log.debug("EPR = " + epr);
                  }
                }
               
              } else if (log.isDebugEnabled()) {
                log.debug("ODE has no EPR for this message exchange");
              }
             
              // The actual WS invocation
              Dispatch<SOAPMessage> proxy = getDispatcher(epr, port);
              setEndpointFromUDDI(proxy);
             
              try {
                // Set SOAPAction
                if (soapAction != null) {
                  // Setting soap action using both approaches, as CXF needs one and JBossWS-Native the other
                  proxy.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, soapAction);
                  MimeHeaders hd = soapRequestMessage.getMimeHeaders();
                  hd.addHeader("SOAPAction", soapAction);
                } else if (log.isDebugEnabled()) {
                  log.debug("SOAPAction not set");
                }

                // Set client side timeout for the invocation
                proxy.getRequestContext().put("javax.xml.ws.client.receiveTimeout", Long.toString(timeout));
               
                  SOAPMessage soapResponseMessage = proxy.invoke(soapRequestMessage);

                  if (log.isDebugEnabled()) {
                    log.debug("Riftsaw soap response message: \n" + JavaUtils.getSoapMessageASString(soapResponseMessage));
                  }
                 
                  // Create ODE response
                  Message odeResponse = mex.createMessage(mex.getOperation().getOutput().getMessage().getQName());
                  if(soapResponseMessage.getSOAPBody().hasFault())
                  {
                    // fault handling
                    Document odeMsg = DOMUtils.newDocument();
                    Element odeMsgEl = odeMsg.createElementNS(null, "message");
                    odeMsg.appendChild(odeMsgEl);
                   
                    Fault fault = messageAdapter.parseSoapFault(odeMsgEl, soapResponseMessage, mex.getOperation());

                    handleFault(mex, fault, soapResponseMessage.getSOAPBody().getFault(), odeMsgEl);
                   
                  }
                  else
                  {
                    messageAdapter.parseSoapResponse(new ODEMessageAdapter(odeResponse),
View Full Code Here

            out.println("\nOutbound message:");
        } else {
            out.println("\nInbound message:");
        }

        SOAPMessage message = smc.getMessage();
        try {
            message.writeTo(out);
            out.println();
        } catch (Exception e) {
            out.println("Exception in handler: " + e);
        }
View Full Code Here

        //We need to get a new mex from persistence layer.
        PartnerRoleMessageExchange mex = (PartnerRoleMessageExchange) engine.getBpelServer().getEngine().getMessageExchange(mexId);
                try
                {
                  // Create SOAPMessage
                  SOAPMessage soapRequestMessage = MessageFactory.newInstance().createMessage();
                  if(log.isDebugEnabled())
                    log.debug( "ODE outbound message: \n" +DOMWriter.printNode(mex.getRequest().getMessage(), true) );
                 
              String soapAction=messageAdapter.createSoapRequest(soapRequestMessage,
                          new ODEMessageAdapter(mex.getRequest()), mex.getOperation());

                  if (log.isDebugEnabled()) {
                    log.debug("Riftsaw soap request message: \n" + JavaUtils.getSoapMessageASString(soapRequestMessage));
                  }
                 
                org.apache.ode.bpel.iapi.EndpointReference odeepr=mex.getEndpointReference();
                javax.xml.ws.EndpointReference epr=null;
               
                if (odeepr != null) {
                  if (odeepr instanceof org.apache.ode.bpel.epr.URLEndpoint) {
                    org.apache.ode.bpel.epr.URLEndpoint url=(org.apache.ode.bpel.epr.URLEndpoint)odeepr;
                   
                    javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder builder=
                          new javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder();
                   
                    epr = builder.address(url.getUrl())
                            .serviceName(serviceName)
                            .endpointName(port)
                            .build();
                   
                    if (log.isDebugEnabled()) {
                      log.debug("EPR = " + epr);
                    }
                  }
                 
                } else if (log.isDebugEnabled()) {
                  log.debug("ODE has no EPR for this message exchange");
                }
               
                  // The actual WS invocation
                  Dispatch<SOAPMessage> proxy = getDispatcher(epr, port);
                  setEndpointFromUDDI(proxy);
                 
                  // Set SOAPAction
                  if (soapAction != null) {
                    // Setting soap action using both approaches, as CXF needs one and JBossWS-Native the other
                    proxy.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, soapAction);
                    MimeHeaders hd = soapRequestMessage.getMimeHeaders();
                    hd.addHeader("SOAPAction", soapAction);
                  } else if (log.isDebugEnabled()) {
                    log.debug("SOAPAction not set");
                  }
                 
View Full Code Here

      Boolean outboundProperty = (Boolean) messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

      // Mensagem chegando
      if (!outboundProperty.booleanValue()) {
        SOAPMessageContext sctx = (SOAPMessageContext) messageContext;
            SOAPMessage message     = sctx.getMessage();
            SOAPPart sp             = message.getSOAPPart();
            SOAPEnvelope senv       = sp.getEnvelope();
            SOAPHeader sh           = senv.getHeader();
           
            System.out.println("1: " + senv.getNodeName());
            Iterator it2 = senv.getChildElements();
View Full Code Here

        RMProperties rmps = RMContextUtils.retrieveRMProperties(context, true);
        if (null == rmps) {
            // nothing to encode
            return;
        }
        SOAPMessage message = context.getMessage();
        try {
            SOAPEnvelope env = message.getSOAPPart().getEnvelope();
            SOAPHeader header = env.getHeader() != null
                                ? env.getHeader()
                                : env.addHeader();
                               
            discardRMHeaders(header);
View Full Code Here

     * @param context the messsage context
     * @param the decoded MAPs
     * @exception SOAPFaultException if decoded MAPs are invalid
     */
    private void decode(SOAPMessageContext context) {
        SOAPMessage message = context.getMessage();
        RMProperties rmps = unmarshalRMProperties(message);
        RMContextUtils.storeRMProperties(context, rmps, false);
    }
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.