Html SAXException: 坏信封标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/662972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SAXException: bad envelope tag
提问by
I'm trying to connect to a webservice https protected through a webservice client. Eclipse generated a stub based webservice client and looks nice to me. The problem comes when I try to call a method from the webservice:
我正在尝试连接到通过网络服务客户端保护的网络服务 https。Eclipse 生成了一个基于存根的 Web 服务客户端,对我来说看起来不错。当我尝试从 webservice 调用方法时出现问题:
String a = (String)webservice.userProfileServices(xml);
I'm also using the following SOAP headers:
我还使用了以下 SOAP 标头:
esgGatewayPort = (new EsgGatewayLocator()).getesgGatewayPort();
//setting the authentication header
PrefixedQName name = new PrefixedQName("http://schemas.xmlsoap.org/ws/2002/07/secext","Security","wsse");
System.out.println("Setting headers for authentication");
org.apache.axis.message.SOAPHeaderElement sh = new org.apache.axis.message.SOAPHeaderElement(name);
SOAPElement sub;
try {
String clntUserName="myUser";
String clntPassword="myPassword";
sub = sh.addChildElement("UsernameToken");
SOAPElement element = sub.addChildElement("Username");
element.addTextNode(clntUserName);
element = sub.addChildElement("Password");
element.addTextNode(clntPassword);
((org.apache.axis.client.Stub) esgGatewayPort).setHeader(sh);
} catch (SOAPException e) {
e.printStackTrace();
}
I receive the following:
我收到以下信息:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Bad envelope tag: HTML
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Bad envelope tag: HTML
at org.apache.axis.message.EnvelopeBuilder.startElement(EnvelopeBuilder.java:71)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:133)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:153)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
Any help will be truly appreciated.
任何帮助将不胜感激。
回答by Lucas Pires
Wrong format of the endpoint
端点格式错误
Ex: http://localhost:8080/YourService/
例如:http://localhost:8080/YourService/
Ex: http://localhost:8080/YourService?wsdl
例如:http://localhost:8080/YourService?wsdl
Correct endpoint format to set the constructor
正确的端点格式以设置构造函数
回答by Sofia
I resolved the problem in WAS (WebSphere Application Server), following http://www-01.ibm.com/support/docview.wss?uid=swg1PK54518. Applying the appropriate Fix Pack for your version of WAS resolved the issue.
我在 WAS (WebSphere Application Server) 中解决了这个问题,遵循http://www-01.ibm.com/support/docview.wss?uid=swg1PK54518。为您的 WAS 版本应用适当的 Fix Pack 解决了该问题。
回答by Nnamdi Jibunoh
The problem is probably that you are trying to bind to a https service using http. I had this problem when eclipse generated the stubs for me from a wsdl that was hosted on a https server.
问题可能是您正在尝试使用 http 绑定到 https 服务。当 eclipse 从托管在 https 服务器上的 wsdl 为我生成存根时,我遇到了这个问题。
Edit the generated files by eclipse that points to the server URL and it should connect correctly.
通过 eclipse 编辑生成的文件,指向服务器 URL,它应该正确连接。
Hope that helps.
希望有帮助。
回答by siddagrl
In my case it got resolved after removing "/" from end of the URL in Axis (not Axis2)
在我的情况下,它在从 Axis(不是 Axis2)中的 URL 末尾删除“/”后得到解决
The URL which I was using http://localhost:7000/myWS/
After changing it to http://localhost:7000/myWS
worked fine!
我正在使用的 URL 将其http://localhost:7000/myWS/
更改为http://localhost:7000/myWS
工作正常后!
Exception:Main: org.xml.sax.SAXException: Bad envelope tag: table
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
例外:Main: org.xml.sax.SAXException: Bad envelope tag: table
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)