Search in sources :

Example 26 with ReferenceParametersType

use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.

the class MemoryResourceManagerTest method getUnknownReferenceParamsTest.

@Test(expected = UnknownResource.class)
public void getUnknownReferenceParamsTest() {
    ReferenceParametersType refParams = new ReferenceParametersType();
    Element uuid = DOMUtils.getEmptyDocument().createElementNS(MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
    uuid.setTextContent("123456");
    refParams.getAny().add(uuid);
    resourceManager.get(refParams);
}
Also used : Element(org.w3c.dom.Element) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Test(org.junit.Test)

Example 27 with ReferenceParametersType

use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.

the class MemoryResourceManagerTest method getEmptyRepresentationTest.

@Test
public void getEmptyRepresentationTest() {
    ReferenceParametersType refParams = resourceManager.create(new Representation());
    Representation returnedRepresentation = resourceManager.get(refParams);
    Assert.assertNull(returnedRepresentation.getAny());
}
Also used : ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Representation(org.apache.cxf.ws.transfer.Representation) Test(org.junit.Test)

Example 28 with ReferenceParametersType

use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.

the class MemoryResourceManagerTest method deleteUnknownReferenceParamsTest.

@Test(expected = UnknownResource.class)
public void deleteUnknownReferenceParamsTest() {
    ReferenceParametersType refParams = new ReferenceParametersType();
    Element uuid = DOMUtils.getEmptyDocument().createElementNS(MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
    uuid.setTextContent("123456");
    refParams.getAny().add(uuid);
    resourceManager.delete(refParams);
}
Also used : Element(org.w3c.dom.Element) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Test(org.junit.Test)

Example 29 with ReferenceParametersType

use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.

the class MemoryResourceManagerTest method putUnknownReferenceParamsTest.

@Test(expected = UnknownResource.class)
public void putUnknownReferenceParamsTest() {
    ReferenceParametersType refParams = new ReferenceParametersType();
    Element uuid = DOMUtils.getEmptyDocument().createElementNS(MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
    uuid.setTextContent("123456");
    refParams.getAny().add(uuid);
    resourceManager.put(refParams, new Representation());
}
Also used : Element(org.w3c.dom.Element) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Representation(org.apache.cxf.ws.transfer.Representation) Test(org.junit.Test)

Example 30 with ReferenceParametersType

use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.

the class MAPCodec method encodeReferenceParameters.

private void encodeReferenceParameters(AddressingProperties maps, SoapMessage msg, JAXBContext ctx) throws JAXBException {
    Element header = null;
    EndpointReferenceType toEpr = maps.getToEndpointReference();
    if (null != toEpr) {
        ReferenceParametersType params = toEpr.getReferenceParameters();
        if (null != params) {
            for (Object o : params.getAny()) {
                if (o instanceof Element || o instanceof JAXBElement) {
                    if (header == null) {
                        header = getHeaderFactory().getHeader(msg.getVersion());
                    }
                    JAXBElement<?> jaxbEl = null;
                    if (o instanceof Element) {
                        Element e = (Element) o;
                        Node importedNode = header.getOwnerDocument().importNode(e, true);
                        header.appendChild(importedNode);
                    } else {
                        jaxbEl = (JAXBElement<?>) o;
                        ctx.createMarshaller().marshal(jaxbEl, header);
                    }
                    Element lastAdded = (Element) header.getLastChild();
                    header.removeChild(lastAdded);
                    addIsReferenceParameterMarkerAttribute(lastAdded, maps.getNamespaceURI());
                    Header holder = new Header(new QName(lastAdded.getNamespaceURI(), lastAdded.getLocalName()), lastAdded);
                    msg.getHeaders().add(holder);
                } else {
                    LOG.log(Level.WARNING, "IGNORE_NON_ELEMENT_REF_PARAM_MSG", o);
                }
            }
        }
    }
}
Also used : EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) SoapHeader(org.apache.cxf.binding.soap.SoapHeader) Header(org.apache.cxf.headers.Header) QName(javax.xml.namespace.QName) JAXBElement(javax.xml.bind.JAXBElement) Element(org.w3c.dom.Element) Node(org.w3c.dom.Node) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) JAXBElement(javax.xml.bind.JAXBElement)

Aggregations

ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)76 Test (org.junit.Test)65 Server (org.apache.cxf.endpoint.Server)54 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)53 MemoryResourceManager (org.apache.cxf.ws.transfer.manager.MemoryResourceManager)51 Resource (org.apache.cxf.ws.transfer.resource.Resource)51 Element (org.w3c.dom.Element)50 ExpressionType (org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType)48 ValueType (org.apache.cxf.ws.transfer.dialect.fragment.ValueType)44 Put (org.apache.cxf.ws.transfer.Put)33 Fragment (org.apache.cxf.ws.transfer.dialect.fragment.Fragment)32 PutResponse (org.apache.cxf.ws.transfer.PutResponse)26 Representation (org.apache.cxf.ws.transfer.Representation)21 Get (org.apache.cxf.ws.transfer.Get)17 GetResponse (org.apache.cxf.ws.transfer.GetResponse)17 ObjectFactory (org.apache.cxf.ws.transfer.dialect.fragment.ObjectFactory)16 JAXBElement (javax.xml.bind.JAXBElement)8 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)8 QName (javax.xml.namespace.QName)4 CreateResponse (org.apache.cxf.ws.transfer.CreateResponse)4