本文整理汇总了Java中javax.xml.ws.Service.createDispatch方法的典型用法代码示例。如果您正苦于以下问题:Java Service.createDispatch方法的具体用法?Java Service.createDispatch怎么用?Java Service.createDispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.ws.Service
的用法示例。
在下文中一共展示了Service.createDispatch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDispatch
import javax.xml.ws.Service; //导入方法依赖的package包/类
/**
* Creates a {@link Dispatch} that can be used to talk to this EPR.
*
* <p>
* All the normal WS-Addressing processing happens automatically,
* such as setting the endpoint address to {@link #getAddress() the address},
* and sending the reference parameters associated with this EPR as
* headers, etc.
*/
public @NotNull <T> Dispatch<T> createDispatch(
@NotNull Service jaxwsService,
@NotNull Class<T> type,
@NotNull Service.Mode mode,
WebServiceFeature... features) {
// TODO: implement it in a better way
return jaxwsService.createDispatch(toSpec(),type,mode,features);
}
示例2: main
import javax.xml.ws.Service; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, TransformerException {
try {
String address = deployWebservice();
Service service = Service.create(new URL(address), ServiceImpl.SERVICE_NAME);
Dispatch<Source> d = service.createDispatch(ServiceImpl.PORT_NAME, Source.class, Service.Mode.MESSAGE);
Source response = d.invoke(new StreamSource(new StringReader(XML_REQUEST)));
String resultXml = toString(response);
log("= request ======== \n");
log(XML_REQUEST);
log("= result ========= \n");
log(resultXml);
log("\n==================");
boolean xsAnyMixedPartSame = resultXml.contains(XS_ANY_MIXED_PART);
log("resultXml.contains(XS_ANY_PART) = " + xsAnyMixedPartSame);
if (!xsAnyMixedPartSame) {
fail("The xs:any content=mixed part is supposed to be same in request and response.");
throw new RuntimeException();
}
log("TEST PASSED");
} finally {
stopWebservice();
// if you need to debug or explore wsdl generation result
// comment this line out:
deleteGeneratedFiles();
}
}