- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个非常专业的环境,我的任务是通过套接字发送以下 HTTP 请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.hp.com/SM/7" xmlns:com="http://schemas.hp.com/SM/7/Common" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
<soapenv:Header/>
<soapenv:Body>
<ns1:CreateTsiIncidentRequest>
<ns1:keys>
<ns1:IncidentID type="String"/>
</ns1:keys>
<ns1:model>
<ns1:instance>
<ns1:Criticality type="String">MEDIUM</ns1:Criticality>
<ns1:AssignmentGroup type="String">TESTSMX_TEST-ASSIGNMENT-GROUP</ns1:AssignmentGroup>
<ns1:Description type="String">unverzüglich gemäß den Incident-/Changeprozessen zu korrigieren. Bei Fragen wenden Sie sich bitte an das zuständige Engineering, DPS Security ( DPS-Security@t-systems.com ), oder an die Toolbetreiber &quot;AuditServer&quot; ( siux-win-audit-sup@t-systems.com ). </ns1:Description>
<ns1:ContactFirstName type="String">SARAH</ns1:ContactFirstName>
<ns1:Title type="String">SIUX / WinAudit (FATAL)</ns1:Title>
<ns1:Category2 type="String">OTHER</ns1:Category2>
<ns1:ReportedByUserID type="String">SARAHWS</ns1:ReportedByUserID>
<ns1:ServiceRestriction type="String">MEDIUM</ns1:ServiceRestriction>
<ns1:Category1 type="String">SECURITY</ns1:Category1>
<ns1:CustomerName type="String">TSI DUMMY COMPANY</ns1:CustomerName>
<ns1:ReportedByFirstName type="String">SARAH</ns1:ReportedByFirstName>
<ns1:ReportedByLastName type="String">SARAH</ns1:ReportedByLastName>
<ns1:CustomerLocation type="String">TSI DUMMY LOCATION</ns1:CustomerLocation>
<ns1:NotifiedBy type="String">sarah</ns1:NotifiedBy>
<ns1:AffectedCI type="String">TENEBROUS</ns1:AffectedCI>
</ns1:instance>
</ns1:model>
</ns1:CreateTsiIncidentRequest>
</soapenv:Body>
</soapenv:Envelope>
通过 SOAPUI 发送此请求,我得到了我期望的正确响应。但是,当我通过 JAVA 代码发送它时,我收到以下 FAULT 消息:
Response in 203 ms... 576 bytes.
HTTP/1.1 500 Internal Server Errors
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=781DBD31B6DFEFD940ED16386C22FF36; Path=/SM
Connection: close
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 06 Jun 2014 10:09:01 GMT
Connection: close
SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Unable to create envelope from given source: </faultstring><faultactor>Server</faultactor></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
我尝试搜索此故障消息,例如这到底意味着什么,但它似乎太基本了,我在任何地方都找不到它。处理请求发送的 JAVA 代码如下所示:
OutputStream os = null;
try {
os = connection.getOutputStream();
} catch (IOException ex) {
Logger.getLogger(TEST_EX.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (os != null) {
StringBuilder requestBuilder = new StringBuilder();
requestBuilder.append(String.format("POST %s HTTP/1.1\r\n", path));
requestBuilder.append(String.format("%s: %s\r\n", "Accept-Encoding", "deflate"));
requestBuilder.append(String.format("%s: %s\r\n", "Content-Type", "text/xml;charset=UTF-8"));
requestBuilder.append(String.format("%s: %s\r\n", "SOAPAction", soapAction));
requestBuilder.append(String.format("%s: %s\r\n", "Content-Length", request.length()));
requestBuilder.append(String.format("%s: %s\r\n", "Host", String.format("%s:%s", endpoint, port)));
requestBuilder.append(String.format("%s: %s\r\n", "Connection", "Keep-Alive"));
requestBuilder.append(String.format("%s: %s\r\n", "Authorization", String.format("Basic %s", enc)));
requestBuilder.append("\r\n");
final String RequestHeaders = requestBuilder.toString();
final byte[] HeaderBytes = RequestHeaders.getBytes(Charset.forName("UTF-8"));
final byte[] RequestBytes = request.getBytes(Charset.forName("UTF-8"));
try {
os.write(HeaderBytes, 0, HeaderBytes.length);
os.write(RequestBytes, 0, RequestBytes.length);
// Wait for response and then start processing it:
InputStream is = connection.getInputStream();
while (is.available() <= 0) {
try {
Thread.sleep(50);
} catch (InterruptedException ex) {
Logger.getLogger(TEST_EX.class.getName()).log(Level.SEVERE, null, ex);
}
}
byte[] bytes = convert(is);
response = new String(bytes, 0, bytes.length, Charset.forName("UTF-8"));
} catch (final IOException ex) {
Logger.getLogger(TEST_EX.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
该请求是来自工作 SOAPUI 示例的 Ctrl+C 和 Ctrl+V。 HTTP header 再次从那里复制。最后,我可以使用 JAVA 源提供 Wireshark 跟踪,了解消息在线路上的样子:
POST /SM/7/ws HTTP/1.1
Accept-Encoding: deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "Create"
Content-Length: 2101
Host: 10.163.209.211:4650
Connection: Keep-Alive
Authorization: Basic V1NURVNUOlN0YXJ0MTIz
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.hp.com/SM/7" xmlns:com="http://schemas.hp.com/SM/7/Common" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
<soapenv:Header/>
<soapenv:Body>
<ns1:CreateTsiIncidentRequest>
<ns1:keys>
<ns1:IncidentID type="String"/>
</ns1:keys>
<ns1:model>
<ns1:instance>
<ns1:Criticality type="String">MEDIUM</ns1:Criticality>
<ns1:AssignmentGroup type="String">TESTSMX_TEST-ASSIGNMENT-GROUP</ns1:AssignmentGroup>
<ns1:Description type="String">unverzüglich gemäß den Incident-/Changeprozessen zu korrigieren. Bei Fragen wenden Sie sich bitte an das zustündige Engineering, DPS Security ( DPS-Security@t-systems.com ), oder an die Toolbetreiber &quot;AuditServer&quot; ( siux-win-audit-sup@t-systems.com ). </ns1:Description>
<ns1:ContactFirstName type="String">SARAH</ns1:ContactFirstName>
<ns1:Title type="String">SIUX / WinAudit (FATAL)</ns1:Title>
<ns1:Category2 type="String">OTHER</ns1:Category2>
<ns1:ReportedByUserID type="String">SARAHWS</ns1:ReportedByUserID>
<ns1:ServiceRestriction type="String">MEDIUM</ns1:ServiceRestriction>
<ns1:Category1 type="String">SECURITY</ns1:Category1>
<ns1:CustomerName type="String">TSI DUMMY COMPANY</ns1:CustomerName>
<ns1:ReportedByFirstName type="String">SARAH</ns1:ReportedByFirstName>
<ns1:ReportedByLastName type="String">SARAH</ns1:ReportedByLastName>
<ns1:CustomerLocation type="String">TSI DUMMY LOCATION</ns1:CustomerLocation>
<ns1:NotifiedBy type="String">sarah</ns1:NotifiedBy>
<ns1:AffectedCI type="String">TENEBROUS</ns1:AffectedCI>
</ns1:instance>
</ns1:model>
</ns1:CreateTsiIncidentRequest>
</soapenv:Body>
</soapenv:Envelope>HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=9FB420040977A242EF2822F5A03F1E9C; Path=/SM
Connection: close
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 06 Jun 2014 10:26:46 GMT
Connection: close
12f
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Unable to create envelope from given source: </faultstring><faultactor>Server</faultactor></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
0
使用 SOAP-UI:
POST /SM/7/ws HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "Create"
Content-Length: 2154
Host: 10.163.209.211:4650
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Authorization: Basic V1NURVNUOlN0YXJ0MTIz
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.hp.com/SM/7" xmlns:com="http://schemas.hp.com/SM/7/Common" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
<soapenv:Header/>
<soapenv:Body>
<ns1:CreateTsiIncidentRequest>
<ns1:keys>
<ns1:IncidentID type="String"/>
</ns1:keys>
<ns1:model>
<ns1:instance>
<ns1:Criticality type="String">MEDIUM</ns1:Criticality>
<ns1:AssignmentGroup type="String">TESTSMX_TEST-ASSIGNMENT-GROUP</ns1:AssignmentGroup>
<ns1:Description type="String">unverzüglich gemäß den Incident-/Changeprozessen zu korrigieren. Bei Fragen wenden Sie sich bitte an das zustündige Engineering, DPS Security ( DPS-Security@t-systems.com ), oder an die Toolbetreiber &quot;AuditServer&quot; ( siux-win-audit-sup@t-systems.com ). </ns1:Description>
<ns1:ContactFirstName type="String">SARAH</ns1:ContactFirstName>
<ns1:Title type="String">SIUX / WinAudit (FATAL)</ns1:Title>
<ns1:Category2 type="String">OTHER</ns1:Category2>
<ns1:ReportedByUserID type="String">SARAHWS</ns1:ReportedByUserID>
<ns1:ServiceRestriction type="String">MEDIUM</ns1:ServiceRestriction>
<ns1:Category1 type="String">SECURITY</ns1:Category1>
<ns1:CustomerName type="String">TSI DUMMY COMPANY</ns1:CustomerName>
<ns1:ReportedByFirstName type="String">SARAH</ns1:ReportedByFirstName>
<ns1:ReportedByLastName type="String">SARAH</ns1:ReportedByLastName>
<ns1:CustomerLocation type="String">TSI DUMMY LOCATION</ns1:CustomerLocation>
<ns1:NotifiedBy type="String">sarah</ns1:NotifiedBy>
<ns1:AffectedCI type="String">TENEBROUS</ns1:AffectedCI>
</ns1:instance>
</ns1:model>
</ns1:CreateTsiIncidentRequest>
</soapenv:Body>
</soapenv:Envelope>
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Keep-Alive: timeout=1200000, max=1000
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Fri, 06 Jun 2014 10:28:11 GMT
a
..........
536
.W.n.6.~.B.C.U...fu.a....,;....0....\%R%............-..e...
.!......<....`.......K?....}.3*z..Km.e.3...q...t.....SC..xmhh....g.....G...x4&..r.E...(.BD)...2..]C.....K....j.).D.at.n....{..gz...?......,...
.n.h.t.f1/:1...7...^..c0c......9'9....Egq.Z...<7....l."y..5...`5`.&O.uBa.4VC...(.X.IX.c3A...B...w.....f5..`u.3.4..d.../.m.}...e..'9..f.^h........2..m..iM.".3..X..#.....E..%.)."..+'tF.5TR.......F......>.L..qQ}......4...-..TS.+...'.....z...M.g..Q...
'...l.wj.u...D.8..a.;.f.el!lkV$k...Rce[..$.9L....h
..A..o.......z...P..Nf7..2..!.1'......y.....c......?...s...........K...yDS\p.....|)...9I...v,c.....#.>&..C..h...; ..E..H.QDQ...W...4!)F.M..X9~..7.
p\...L5......RH.........-.6.b..C..;,9& x.C...W
_...sX..#0..../..#..EY..uP.`..[P...d..7...V..!(.Q..r&0.....ys....A.u....K[...Z.0_..t.P.D....W.....I.d.7H&.n.........3....2....'...a?1..D........X.....\..;..w;.......J......(.r.m...^7j.A..+...l.....l.|........UU.2R3......6M._..Q..w
<.n....q......l.....#.b.r.....t+=..........`....,(.bN
U.dkt.d.#........*.F.V.\eQ....2.+.4 .....?....7.+.1...<>........u.K..fS/|....`..,......C....C........z;.O...p......5..d.j..T.
_%+)H'&......:.Y..=..........Cw....Q........j.Y[9n..O.nS**@3...~4@........qmb[c&.=Q..2.......+.U...J.!P......3ho...i0.R.!.f8iU..Q.p..ui......~.y..U.u.E$J9...|O...^@...>f.s..v1....!.v..s8..0..`Nq......ZC.
...K,......m...<...a...
0
我理解的唯一区别是:我没有将 gzip 作为 Accept-Encoding 发送,但即使我这样做,我也会收到完全相同的消息。有人能找出这里出了什么问题吗?
额外信息:
如果我从请求中删除像 öüűőßä 这样的特殊字符,我会得到有效的响应。我认为问题与这些字符有关,但老实说,我不知道是什么,因为我将其作为 UTF-8 发送,如果我没有记错的话,UTF-8 包含这些字符?
最佳答案
另外两件事是不同的
此外,您的套接字响应报告:
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
而soapui响应报告:
Content-Encoding: gzip
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
尝试接受 gzip 并查看这是否会改变您收到的响应消息。
关于java - 通过套接字发送 XMLEncoded SOAP 请求导致无法创建信封,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24079714/
我使用下拉菜单提供一些不同的链接,但我希望这些链接在同一选项卡中打开,而不是在新选项卡中打开。这是我找到的代码,但我对 Javascript 非常缺乏知识 var urlmenu = docume
我对 javascript 不太了解。但我需要一个垂直菜单上的下拉菜单,它是纯 JavaScript,所以我从 W3 复制/粘贴脚本:https://www.w3schools.com/howto/t
我已经坐了 4 个小时,试图让我的导航显示下 zipper 接垂直,但它继续水平显示它们。我无法弄清楚为什么会发生这种情况或如何解决它。 如果有人能告诉我我做错了什么,我将不胜感激。我有一个潜移默化的
我正在尝试创建选项卡式 Accordion 样式下拉菜单。我使用 jQuery 有一段时间了,但无法使事件状态达到 100%。 我很确定这是我搞砸的 JS。 $('.service-button').
对于那些从未访问过 Dropbox 的人,这里是链接 https://www.dropbox.com/ 查看“登录”的下拉菜单链接。我如何创建这样的下 zipper 接? 最佳答案 这是 fiddle
我正在制作一个 Liferay 主题,但我在尝试设计导航菜单的样式时遇到了很多麻烦。我已经为那些没有像这样下拉的人改变了导航链接上的经典主题悬停功能: .aui #navigation .nav li
如果您将鼠标悬停在 li 上,则会出现一个下拉菜单。如果您将指针向下移至悬停时出现的 ul,我希望链接仍然带有下划线,直到您将箭头从 ul 或链接移开。这样你就知道当菜单下拉时你悬停在哪个菜单上。 知
我有一个带有多个下拉菜单的导航栏。因此,当我单击第一个链接时,它会打开下拉菜单,但是当我单击第二个链接时,第一个下拉菜单不会关闭。 (所以如果用户点击第二个链接我想关闭下拉菜单) // main.js
我正在尝试制作一个导航下拉菜单(使用 Bootstrap 3),其中链接文本在同一行上有多个不同的对齐方式。 在下面的代码中,下拉列表 A 中的链接在 HTML 中有空格字符来对齐它们,但是空白被忽略
我希望有人能帮我解决这个 Bootstrap 问题,因为我很困惑。 有人要求我在底部垂直对齐图像和其中包含图像的链接。 我面临的问题是他们还希望链接在链接/图像组合上具有 pull-right,这会杀
我正在构建一个 Rails 应用程序,并希望指向我的类的每个实例的“显示”页面的链接显示在“索引”页面的下拉列表中。我目前正在使用带有 options_from_collection_for_sele
我有以下 Bootstrap3 导航菜单 ( fiddle here )。我想设置“突出显示”项及其子链接与下拉列表 1 和 2 链接不同的链接文本(和悬停)的样式。我还希望能够以不同于 Highli
我对导航栏中的下拉菜单有疑问。对于普通的导航链接(无下拉菜单),我将菜单文本放在 H3 中,但是当我尝试对下 zipper 接执行相同操作时,箭头不在标题旁边,而是在标题下方。我决定用 span 替换
我是一名优秀的程序员,十分优秀!