gpt4 book ai didi

spring - jaxws wsdl 解析问题

转载 作者:行者123 更新时间:2023-12-01 05:22:49 25 4
gpt4 key购买 nike

我有一个使用 JAX-WS 创建的 WebService,我编写了一个 JUnit 以通过以下方式连接到它:

public class LicenseSvcClient {


private static final String WS_URL = "https://dubdubdub.com/licenseService?wsdl";
private static LicenseService licenseService;

@BeforeClass
public static void init() throws MalformedURLException{
URL url = new URL(WS_URL);
QName qname = new QName("http://webservices.activation.cellebrite/", "LicenseServiceImplService");
Service service = Service.create(url, qname);
licenseService = service.getPort(LicenseService.class);
Map<String, Object> req_ctx = ((BindingProvider)licenseService).getRequestContext();
req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, WS_URL);

Map<String, List<String>> headers = new HashMap<String, List<String>>();

req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);

}

@Test
public void lol(){

licenseService.hasCellewiseLicense("Roflol");
}

}

这个 JUnit 工作得很好,它连接到服务,但是,当我尝试从另一个应用程序连接到这个服务时,它抛出以下异常,请注意我使用的是完全相同的代码。
[Fatal Error] licenseService?xsd=1:6:3: The element type "hr" must be terminated by the matching end-tag "</hr>".
[Fatal Error] licenseService?xsd=1:6:3: The element type "hr" must be terminated by the matching end-tag "</hr>".
2013-03-24 16:52:41,292 ERROR DefaultExceptionMapper:114 - Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public cellebrite.urs.web.page.cellewise.CellewiseCodeGenerationPage()'. Might be it doesn't exist, may be it is not visible (public).
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:196)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:68)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47)
at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103)
at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264)
at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:177)
... 34 more
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:150)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:91)
at javax.xml.ws.Service.<init>(Unknown Source)
at javax.xml.ws.Service.create(Unknown Source)
at com.cellebrite.shared.webservice.LicenseServiceClient.init(LicenseServiceClient.java:59)
at com.cellebrite.shared.webservice.LicenseServiceClient.load(LicenseServiceClient.java:79)
at com.cellebrite.shared.webservice.LicenseServiceClient.isCellewiseEnabled(LicenseServiceClient.java:70)
at WICKET_com.cellebrite.shared.webservice.LicenseServiceClient$$FastClassByCGLIB$$d8ec55d.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.apache.wicket.proxy.LazyInitProxyFactory$CGLibInterceptor.intercept(LazyInitProxyFactory.java:318)
at WICKET_com.cellebrite.shared.webservice.LicenseServiceClient$$EnhancerByCGLIB$$57f3c545.isCellewiseEnabled(<generated>)
at cellebrite.urs.web.page.cellewise.CellewiseCodeGenerationPage.canAccess(CellewiseCodeGenerationPage.java:49)
at cellebrite.urs.web.page.cellewise.CellewiseCodeGenerationPage.<init>(CellewiseCodeGenerationPage.java:41)
... 39 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:94)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:148)
... 51 more
Caused by: javax.wsdl.WSDLException: WSDLException (at /definitions/types/xsd:schema): faultCode=PARSER_ERROR: Problem parsing 'http://dubdubdub.com/licenseService?xsd=1'.: org.xml.sax.SAXParseException: The element type "hr" must be terminated by the matching end-tag "</hr>".
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:242)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:191)
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
... 53 more
Caused by: org.xml.sax.SAXParseExceptionpublicId: http://dubdubdub.com/licenseService?xsd=1; systemId: http://dubdubdub.com/licenseService?xsd=1; lineNumber: 6; columnNumber: 3; The element type "hr" must be terminated by the matching end-tag "</hr>".
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
... 63 more

最佳答案

我猜,堆栈跟踪中给出的 URL http://dubdubdub.com/licenseService?xsd=1从“真实”服务客户端调用时返回错误消息。

也许您应该检查给定的 url 是否真的有效。 WSDL 解析器提示未关闭的 <hr>标记表明 Web 服务客户端正在获取错误页面而不是可解析的架构文件。

关于spring - jaxws wsdl 解析问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15599992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com