Package org.apache.ws.commons.soap

Examples of org.apache.ws.commons.soap.SOAPFactory


    }

    public void submitPurchaseOrderTest()
            throws Exception {
        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = omFactory.getDefaultEnvelope();
        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(
                omFactory,
                XMLInputFactory.newInstance().
                createXMLStreamReader(
                        new InputStreamReader(
View Full Code Here


                Object obj = groovyObject.invokeMethod(methodName, arg);
                if (obj == null) {
                    throw new AxisFault(Messages.getMessage("groovyNoanswer"));
                }
               
                SOAPFactory fac = null;
                if(inMessage.isSOAP11()){
                    fac = OMAbstractFactory.getSOAP11Factory();
                }else{
                    fac = OMAbstractFactory.getSOAP12Factory();
                }
                SOAPEnvelope envelope = fac.getDefaultEnvelope();
                OMNamespace ns =
                    fac.createOMNamespace("http://soapenc/", "res");
                OMElement responseElement =
                    fac.createOMElement(methodName + "Response", ns);
                String outMessageString = obj.toString();
                // System.out.println("outMessageString = " + outMessageString);
                // responseElement.setText(outMessageString);
                responseElement.addChild(getpayLoad(outMessageString));
                envelope.getBody().addChild(responseElement);
View Full Code Here

        SOAPEnvelope envelope = msgContext.getEnvelope();
        SOAPHeader soapHeader = envelope.getHeader();

        // if there is no soap header in the envelope being processed, add one.
        if (soapHeader == null) {
            SOAPFactory soapFac = msgContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory();
            soapHeader = soapFac.createSOAPHeader(envelope);
        }

        // by this time, we definitely have some addressing information to be sent. This is because,
        // we have tested at the start of this whether messageInformationHeaders are null or not.
        // So rather than declaring addressing namespace in each and every addressing header, lets
View Full Code Here

            }


            Object[] objectArray = processRequest(methodElement);
            Object resObject = method.invoke(obj, objectArray);
            SOAPFactory fac = getSOAPFactory(inMessage);

            // Handling the response
            OMNamespace ns = fac.createOMNamespace(service.getSchematargetNamespace(),
                    service.getSchematargetNamespacePrefix());
            SOAPEnvelope envelope = fac.getDefaultEnvelope();
            OMElement bodyContent = null;

            if (resObject instanceof Object[]) {
                QName resName = new QName(service.getSchematargetNamespace(),
                        method.getName() + "Response",
View Full Code Here


    protected abstract void extractToEprReferenceParameters(EndpointReference toEPR, SOAPHeader header);

    private void handleNoServiceGroupContextIDCase(MessageContext msgContext) {
        SOAPFactory soapFac = msgContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory();
        SOAPFaultReason soapFaultReason = soapFac.createSOAPFaultReason(null);
        SOAPFaultText soapFaultText = soapFac.createSOAPFaultText(soapFaultReason);
        soapFaultText.setLang("en");
        soapFaultText.setText(Messages.getMessage("serviceGroupIDNotFound"));

        msgContext.setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, soapFaultReason);
    }
View Full Code Here

                    "Value " + i * 100);

        }


        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();

        MessageContext msgCtxt = new MessageContext();
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Submission.WSA_NAMESPACE);
        msgCtxt.setTo(epr);
        msgCtxt.setReplyTo(replyTo);
View Full Code Here

        // this will check whether we can add to epr, if there is one already.
        EndpointReference eprOne = new EndpointReference("http://whatever.org");
        EndpointReference duplicateEpr = new EndpointReference("http://whatever.duplicate.org");
        msgCtxt = new MessageContext();
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
        msgCtxt.setEnvelope(defaultEnvelope);

        msgCtxt.setTo(eprOne);
        outHandler.invoke(msgCtxt);
View Full Code Here

    super(name);
  }
 
  public void runTest(String value, String expected) throws XMLStreamException, FactoryConfigurationError, IOException {
   
    SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    String ns = "http://testuri.org";
    OMNamespace namespace = factory.createOMNamespace(ns,"tst");
   
    String ln = "Child";
   
    OMElement bodyChild = factory.createOMElement(ln,namespace);
    bodyChild.addChild(factory.createText(value));
   
    envelope.getBody().addChild(bodyChild);


    ByteArrayOutputStream byteOutStr = new ByteArrayOutputStream();
View Full Code Here

    public static MessageContext getMessageContext() throws AxisFault {
        OMNamespace namespace, nulNS;
        OMElement operation, value1, value2;
        OMElement subValue1, subValue2, subValue3, subValue4, subValue5;

        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope reqEnv = omFactory.getDefaultEnvelope();
        namespace = reqEnv.declareNamespace(
                "http://schemas.xmlsoap.org/soap/envelope/",
                "SOAP-ENV");
        namespace = reqEnv.declareNamespace(
                "http://schemas.xmlsoap.org/soap/encoding/",
                "SOAP-ENC");
        namespace =
                reqEnv.declareNamespace(
                        "http://www.w3.org/1999/XMLSchema-instance/", "xsi");
        namespace =
                reqEnv.declareNamespace("http://www.w3.org/2001/XMLSchema",
                        "xsd");
        namespace = reqEnv.declareNamespace(
                "http://schemas.xmlsoap.org/wsdl/soap/",
                "soap");
        namespace = reqEnv.declareNamespace("http://schemas.xmlsoap.org/wsdl/",
                "wsdl");
        namespace = reqEnv.declareNamespace(
                "http://webservices.amazon.com/AWSAlexa/2005-02-01",
                "tns");

        nulNS = omFactory.createOMNamespace("", "");

        operation =
                omFactory.createOMElement("Search",
                        "http://webservices.amazon.com/AWSAlexa/2005-02-01",
                        "ns1");
        reqEnv.getBody().addChild(operation);
        operation.addAttribute("encordingStyle",
                "http://schemas.xmlsoap.org/soap/encoding/",
                null);


        value1 = omFactory.createOMElement("SubscriptionId", nulNS);
        value1.addChild(omFactory.createText(AsynchronousClient.amazonkey));
        //this is a valid sample key :- "0Y6WJGPB6TW8AVAHGFR2"));

        value2 = omFactory.createOMElement("Request", nulNS);

        subValue1 = omFactory.createOMElement("ResponseGroup", nulNS);
        subValue1.addChild(omFactory.createText("Web"));

        subValue2 = omFactory.createOMElement("Query", nulNS);
        subValue2.addChild(omFactory.createText(AsynchronousClient.search));

        subValue3 = omFactory.createOMElement("Count", nulNS);
        subValue3.addChild(omFactory.createText(AsynchronousClient.maxResults));

        subValue4 = omFactory.createOMElement("IgnoreWords", nulNS);
        subValue4.addChild(omFactory.createText("90"));

        subValue5 = omFactory.createOMElement("AdultFilter", nulNS);
        subValue5.addChild(omFactory.createText("yes"));

        value2.addChild(subValue5);
        value2.addChild(subValue4);
        value2.addChild(subValue3);
        value2.addChild(subValue2);
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.soap.SOAPFactory

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.