wrappedstyletest.java

来自「Xfire文件 用于开发web service 的一个开源工具 很好用的」· Java 代码 · 共 83 行

JAVA
83
字号
package org.codehaus.xfire.xmlbeans;import javax.xml.namespace.QName;import org.codehaus.xfire.service.MessagePartInfo;import org.codehaus.xfire.service.Service;import org.codehaus.xfire.service.binding.ObjectServiceFactory;import org.codehaus.xfire.soap.SoapConstants;import org.jdom.Document;/** * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a> */public class WrappedStyleTest        extends AbstractXmlBeansTest{    private Service endpoint;    private ObjectServiceFactory factory;    public void setUp()            throws Exception    {        super.setUp();        factory = (ObjectServiceFactory) getServiceFactory();        factory.setStyle(SoapConstants.STYLE_WRAPPED);                endpoint = factory.create(TestService.class,                                  "TestService",                                  "urn:TestService",                                  null);                getServiceRegistry().register(endpoint);    }        public void testParams() throws Exception    {        MessagePartInfo info = (MessagePartInfo)            endpoint.getServiceInfo().getOperation("GetWeatherByZipCode").getInputMessage().getMessageParts().get(0);        assertEquals(new QName("http://codehaus.org/xfire/xmlbeans", "request"), info.getName());    }    public void testInvoke() throws Exception    {        Document response = invokeService("TestService", "/org/codehaus/xfire/xmlbeans/WrappedRequest.xml");                assertNotNull(response);        addNamespace("t", "urn:TestService");        addNamespace("x", "http://codehaus.org/xfire/xmlbeans");        assertValid("//t:mixedRequestResponse/x:response/x:form", response);    }        public void testFault() throws Exception    {        Document response = invokeService("TestService", "/org/codehaus/xfire/xmlbeans/FaultRequest.xml");                assertNotNull(response);        addNamespace("t", "urn:TestService");        addNamespace("x", "http://codehaus.org/xmlbeans/exception");        assertValid("//detail/t:CustomFault[@x:extraInfo='extra']", response);    }        public void testWSDL() throws Exception    {        Document wsdl = getWSDLDocument("TestService");        addNamespace("xsd", SoapConstants.XSD);        assertValid("//xsd:schema[@targetNamespace='urn:TestService']" +                "/xsd:element[@name='mixedRequest']" +                "//xsd:element[@name='string'][@type='xsd:string']", wsdl);        assertValid("//xsd:schema[@targetNamespace='urn:TestService']" +                    "/xsd:element[@name='mixedRequest']" +                    "//xsd:element[@ref='ns1:request']", wsdl);        assertValid("//xsd:schema[@targetNamespace='http://codehaus.org/xmlbeans/exception']" +                    "/xsd:complexType[@name='CustomFault']" +                    "/xsd:attribute[@name='extraInfo']", wsdl);            }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?