本文整理匯總了Java中org.w3.x2003.x05.soapEnvelope.EnvelopeDocument類的典型用法代碼示例。如果您正苦於以下問題:Java EnvelopeDocument類的具體用法?Java EnvelopeDocument怎麽用?Java EnvelopeDocument使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EnvelopeDocument類屬於org.w3.x2003.x05.soapEnvelope包,在下文中一共展示了EnvelopeDocument類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: unsubscribeById
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
private void unsubscribeById(String resourceID, URL host) throws OXFException, ExceptionReport, XmlException, IOException {
SESAdapter adapter = new SESAdapter("0.0.0");
Operation op = new Operation(SESAdapter.UNSUBSCRIBE, null, host.toExternalForm());
ParameterContainer parameter = new ParameterContainer();
parameter.addParameterShell(ISESRequestBuilder.UNSUBSCRIBE_SES_URL, host.toExternalForm());
parameter.addParameterShell(SESRequestBuilder_00.UNSUBSCRIBE_REFERENCE, resourceID);
OperationResult opResult = adapter.doOperation(op, parameter);
EnvelopeDocument env = EnvelopeDocument.Factory.parse(opResult.getIncomingResultAsStream());
XmlCursor cur = env.getEnvelope().getBody().newCursor();
cur.toFirstChild();
if (!(cur.getObject() instanceof UnsubscribeResponse)) {
Assert.fail("Unsubscribe failed! Received an unexpected respone: "+ cur.getObject().xmlText(new XmlOptions().setSaveOuter()));
}
}
示例2: shouldRegisterPublisherAndRemoveAgain
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
@Test
public void
shouldRegisterPublisherAndRemoveAgain()
throws OXFException, ExceptionReport, XmlException, IOException {
ServiceInstance.getInstance().waitUntilAvailable();
EnvelopeDocument envelope = registerPublisher();
logger.info("RegisterPublisher Response from Service: {}", envelope);
Publisher pub = new Publisher(null);
pub.parseResponse(envelope);
Assert.assertNotNull(pub.getResourceID());
envelope = removePublisher(pub.getResourceID(), pub.getPublisherAddress());
logger.info("DestroyRegistration Response from Service: {}", envelope);
}
示例3: unsubscribe
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
private EnvelopeDocument unsubscribe(EnvelopeDocument response) throws OXFException, ExceptionReport, XmlException, IOException {
Subscription sub = new Subscription(null);
sub.parseResponse(response);
SESAdapter adapter = new SESAdapter("0.0.0");
Operation op = new Operation(SESAdapter.UNSUBSCRIBE, null, sub.getManager().getHost().toExternalForm());
StringBuilder sb = new StringBuilder();
sb.append("<rid:ResourceId wsa:IsReferenceParameter=\"true\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" ");
sb.append("xmlns:rid=\"http://ws.apache.org/muse/addressing\">");
sb.append(sub.getResourceID());
sb.append("</rid:ResourceId>");
ParameterContainer parameter = new ParameterContainer();
parameter.addParameterShell(ISESRequestBuilder.UNSUBSCRIBE_SES_URL, sub.getManager().getHost().toExternalForm());
parameter.addParameterShell(ISESRequestBuilder.UNSUBSCRIBE_REFERENCE_XML, sb.toString());
logger.info(SESRequestBuilderFactory.generateRequestBuilder("0.0.0").buildUnsubscribeRequest(parameter));
OperationResult opResult = adapter.doOperation(op, parameter);
EnvelopeDocument envelope = EnvelopeDocument.Factory.parse(opResult.getIncomingResultAsStream());
return envelope;
}
示例4: buildGetFeatureOfInterestRequest
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
@Override
public String buildGetFeatureOfInterestRequest(ParameterContainer parameters) {
//String request = super.buildGetFeatureOfInterestRequest(parameters);
//EnvelopeDocument envelope = addSoapEnvelope(request, GET_FOI_SOAP_HEADER_ACTION);
//return envelope.xmlText(XmlUtil.PRETTYPRINT);
GetFeatureOfInterestDocument xb_getFOIDoc = GetFeatureOfInterestDocument.Factory.newInstance();
GetFeatureOfInterestType xb_getFOI = xb_getFOIDoc.addNewGetFeatureOfInterest();
xb_getFOI.setService((String) parameters.getParameterShellWithServiceSidedName(GET_FOI_SERVICE_PARAMETER).getSpecifiedValue());
xb_getFOI.setVersion((String) parameters.getParameterShellWithServiceSidedName(GET_FOI_VERSION_PARAMETER).getSpecifiedValue());
if (parameters.containsParameterShellWithServiceSidedName("observedProperty")) {
xb_getFOI.addObservedProperty((String) parameters.getParameterShellWithServiceSidedName("observedProperty").getSpecifiedValue());
}
if (parameters.containsParameterShellWithServiceSidedName("procedure")) {
xb_getFOI.addProcedure((String) parameters.getParameterShellWithServiceSidedName("procedure").getSpecifiedValue());
}
EnvelopeDocument envelope = addSoapEnvelope(xb_getFOIDoc.xmlText(), GET_FOI_SOAP_HEADER_ACTION);
return envelope.xmlText(XmlUtil.PRETTYPRINT);
}
示例5: registerPublisher
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
private EnvelopeDocument registerPublisher() throws OXFException, ExceptionReport, XmlException, IOException {
Operation op = new Operation(SESAdapter.REGISTER_PUBLISHER, null,
ServiceInstance.getInstance().getHost().toExternalForm());
ParameterContainer parameters = new ParameterContainer();
parameters.addParameterShell(SESRequestBuilder_00.REGISTER_PUBLISHER_SES_URL, ServiceInstance.getInstance().getHost().toExternalForm());
parameters.addParameterShell(SESRequestBuilder_00.REGISTER_PUBLISHER_SENSORML, readSensorML());
parameters.addParameterShell(SESRequestBuilder_00.REGISTER_PUBLISHER_TOPIC, "test-topic");
OperationResult response = adapter.doOperation(op, parameters);
EnvelopeDocument envelope = EnvelopeDocument.Factory.parse(response.getIncomingResultAsStream());
return envelope;
}
示例6: removePublisher
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
private EnvelopeDocument removePublisher(String resourceId, String managerHost) throws XmlException, IOException, ExceptionReport, OXFException {
Operation op = new Operation(SESAdapter.DESTROY_REGISTRATION, null,
managerHost);
ParameterContainer parameters = new ParameterContainer();
parameters.addParameterShell(SESRequestBuilder_00.DESTROY_REGISTRATION_SES_URL, managerHost);
parameters.addParameterShell(SESRequestBuilder_00.DESTROY_REGISTRATION_REFERENCE, resourceId);
OperationResult response = adapter.doOperation(op, parameters);
EnvelopeDocument envelope = EnvelopeDocument.Factory.parse(response.getIncomingResultAsStream());
return envelope;
}
示例7: requestCapabilities
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
private EnvelopeDocument requestCapabilities() throws OXFException, XmlException, ExceptionReport, IOException {
SESAdapter adapter = new SESAdapter("0.0.0");
Operation op = new Operation(SESAdapter.GET_CAPABILITIES, null,
ServiceInstance.getInstance().getHost().toExternalForm());
ParameterContainer parameters = new ParameterContainer();
parameters.addParameterShell(SESRequestBuilder_00.GET_CAPABILITIES_SES_URL, ServiceInstance.getInstance().getHost().toExternalForm());
OperationResult response = adapter.doOperation(op, parameters);
EnvelopeDocument envelope = EnvelopeDocument.Factory.parse(response.getIncomingResultAsStream());
return envelope;
}
示例8: wrapToSoapEnvelope
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
public static EnvelopeDocument wrapToSoapEnvelope(XmlObject bodyContent, String action) {
EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
Envelope envelope = envelopeDoc.addNewEnvelope();
Header header = envelope.addNewHeader();
XmlCursor cur = header.newCursor();
cur.toFirstContentToken();
cur.insertElementWithText(new QName(ns_addressing,"To","wsa"),"http://www.ogc.org/SOS");
cur.insertElementWithText(new QName(ns_addressing,"Action","wsa"), action);
cur.insertElementWithText(new QName(ns_addressing,"MessageID","wsa"),
UUID.randomUUID().toString());
// cur.beginElement(new QName(ns_addressing,"From","wsa"));
// cur.insertElementWithText(new QName(ns_addressing,"Address","wsa"),
// "http://www.w3.org/2005/08/addressing/role/anonymous");
cur.dispose();
Body body = envelope.addNewBody();
body.set(bodyContent);
XmlCursor cursor = envelopeDoc.newCursor();
if (cursor.toFirstChild())
{
cursor.setAttributeText(new QName("http://www.w3.org/2001/XMLSchema-instance","schemaLocation"), "http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0/sos.xsd");
}
return envelopeDoc;
}
示例9: buildGetObservationRequest
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
@Override
public String buildGetObservationRequest(ParameterContainer parameters) throws OXFException {
parameters.removeParameterShell(parameters.getParameterShellWithCommonName(GET_OBSERVATION_RESPONSE_FORMAT_PARAMETER));
parameters.addParameterShell(GET_OBSERVATION_RESPONSE_FORMAT_PARAMETER, WATERML_20_NS);
String request = super.buildGetObservationRequest(parameters);
EnvelopeDocument envelope = addSoapEnvelope(request, GET_OBS_SOAP_HEADER_ACTION);
return envelope.xmlText(XmlUtil.PRETTYPRINT);
}
示例10: addSoapEnvelope
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
protected EnvelopeDocument addSoapEnvelope(String request, String action) {
XmlObject xb_request = null;
try {
xb_request = XmlObject.Factory.parse(request);
} catch (XmlException e) {
e.printStackTrace();
}
EnvelopeDocument envelope = SoapUtil.wrapToSoapEnvelope(xb_request, action);
return envelope;
}
示例11: shouldReplaceDefaultOM20ResponseFormatWithWaterML20
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
@Test public void
shouldReplaceDefaultOM20ResponseFormatWithWaterML20() throws XmlException, IOException, OXFException {
String request = builder.buildGetObservationRequest(parameters);
EnvelopeDocument envelope = EnvelopeDocument.Factory.parse(request);
GetObservationDocument goDoc = (GetObservationDocument) readBodyNodeFrom(envelope, null);
String actual = goDoc.getGetObservation().getResponseFormat();
Assert.assertThat(actual, is("http://www.opengis.net/waterml/2.0"));
}
示例12: shouldHaveOfficialGDANamespace
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
@Test public void
shouldHaveOfficialGDANamespace() throws XmlException, IOException, OXFException {
parameters.addParameterShell("gdaPrefinalNamespace", "false");
String request = builder.buildGetDataAvailabilityRequest(parameters);
EnvelopeDocument envelope = EnvelopeDocument.Factory.parse(request);
XmlObject gdaDoc = readBodyNodeFrom(envelope, null);
XmlObject[] xml = gdaDoc.selectChildren("http://www.opengis.net/sosgda/1.0", "GetDataAvailability");
Assert.assertThat(xml.length, is(1));
XmlObject[] children = xml[0].selectChildren("http://www.opengis.net/sosgda/1.0", "procedure");
Assert.assertThat(children.length, is(not(0)));
}
示例13: shouldHavePrefinalGDANamespace
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
@Test public void
shouldHavePrefinalGDANamespace() throws XmlException, IOException, OXFException {
parameters.addParameterShell("gdaPrefinalNamespace", "true");
String request = builder.buildGetDataAvailabilityRequest(parameters);
EnvelopeDocument envelope = EnvelopeDocument.Factory.parse(request);
XmlObject gdaDoc = readBodyNodeFrom(envelope, null);
XmlObject[] xml = gdaDoc.selectChildren("http://www.opengis.net/sos/2.0", "GetDataAvailability");
Assert.assertThat(xml.length, is(1));
XmlObject[] children = xml[0].selectChildren("http://www.opengis.net/sos/2.0", "procedure");
Assert.assertThat(children.length, is(not(0)));
}
示例14: shouldStripSoapEnvelopeFromResponse
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
@Test
public void shouldStripSoapEnvelopeFromResponse() throws Exception {
XmlObject xml = XmlFileLoader.loadXmlFileViaClassloader(GO_HYPROFILE_SOAP_RESPONSE, getClass());
if (xml instanceof EnvelopeDocument) {
EnvelopeDocument envelopeDoc = (EnvelopeDocument) xml;
XmlObject body = SoapUtil.readBodyNodeFrom(envelopeDoc, null);
Assert.assertThat(body, is(notNullValue()));
Assert.assertThat(body.schemaType(), is(not(EnvelopeDocument.type)));
Assert.assertThat(body.schemaType(), is(GetObservationResponseDocument.type));
}
}
示例15: shouldSuccesfullySubscribe
import org.w3.x2003.x05.soapEnvelope.EnvelopeDocument; //導入依賴的package包/類
@Test
public void shouldSuccesfullySubscribe()
throws OXFException, XmlException, ExceptionReport, IOException {
ServiceInstance.getInstance().waitUntilAvailable();
logger.info("Subscribing Level 1 (XPath)...");
EnvelopeDocument response = subscribe();
logger.info("Response from SES: {}", response);
Collection<XmlError> errors = XMLBeansParser.validate(response);
Assert.assertTrue("Response are not valid!", errors.isEmpty());
response = unsubscribe(response);
logger.info("Response from SES: {}", response);
errors = XMLBeansParser.validate(response);
Assert.assertTrue("Response are not valid!", errors.isEmpty());
}