问题描述可能很长.请耐心等待并提供任何帮助,因为我不熟悉Web服务.
我做了什么: 我使用Apache CXF RI在java中创建了一个Web服务.我只是创建了一个类,并使用自下而上的开发方法来生成SEI,WSDL和XML文件.
问题是:
现在,如果我请求" http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort/whatIsTheAnswer
",它会产生输出为无绑定操作信息,同时调用未知的params未知方法.
答复如下:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>No binding operation info while invoking unknown
method with params unknown.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
生成的WSDL
是:
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://ws.service.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
name="DeepThoughtService" targetNamespace="http://ws.service.com/">
<wsdl:types>
<schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://ws.service.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://ws.service.com/"
schemaLocation="http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort?xsd=deepthought_schema1.xsd" />
</schema>
</wsdl:types>
<wsdl:message name="whatIsTheAnswerResponse">
<wsdl:part element="tns:whatIsTheAnswerResponse"
name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="whatIsTheAnswer">
<wsdl:part element="tns:whatIsTheAnswer" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="DeepThought">
<wsdl:operation name="whatIsTheAnswer">
<wsdl:input message="tns:whatIsTheAnswer"
name="whatIsTheAnswer"></wsdl:input>
<wsdl:output message="tns:whatIsTheAnswerResponse"
name="whatIsTheAnswerResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DeepThoughtServiceSoapBinding" …
Run Code Online (Sandbox Code Playgroud) 我ajax
在一个jsp
页面上通过URL调用spring控制器/check
.
$.ajax({
type : "GET",
url : "${pageContext.request.contextPath}/check",
data : {
"id" : ${articleCount}
},
success: function(data){
//response from controller
}
});
Run Code Online (Sandbox Code Playgroud)
现在,控制器看起来像,
@RequestMapping("/check")
public String check(@RequestParam Integer id, HttpServletRequest request,
HttpServletResponse response, Model model) {
boolean a = getSomeResult();
if (a == true) {
model.addAttribute("alreadySaved", true);
return view;
} else
model.addAttribute("alreadySaved", false);
return view;
}
Run Code Online (Sandbox Code Playgroud)
我当时是使用模型数据,并试图访问它success: function(data)
的"${alreadySaved}"
,但它显示为空白.
有什么办法可以true/false
在视图页面上接收这些数据吗?
根据这些:
该HashMap
中Java
应该是未排序的,但它被相对于分类Key
.
我认为这是一个问题,因为我需要插入订单数据.所以,我用了LinkedHashMap
.但我仍然困惑为什么HashMap
排序它.
有人能解释一下吗?
我做了一个简单的例子来查看排序.
public static void main(String[] args) {
HashMap<Integer, String> newHashMap = new HashMap<Integer, String>();
newHashMap.put(2, "First");
newHashMap.put(0, "Second");
newHashMap.put(3, "Third");
newHashMap.put(1, "Fourth");
Iterator<Entry<Integer, String>> iterator = newHashMap.entrySet()
.iterator();
while (iterator.hasNext()) {
Map.Entry<Integer, String> entry = iterator.next();
System.out.println("Key: " + entry.getKey());
System.out.println("Value: " + entry.getValue());
iterator.remove();
}
}
Run Code Online (Sandbox Code Playgroud)
结果:
Key: 0
Value: Second
Key: 1
Value: Fourth
Key: 2
Value: First
Key: 3 …
Run Code Online (Sandbox Code Playgroud) 我根据这个网站使用过Boyer Moore算法.这仅在文本中实现模式搜索一次,程序退出.有人可以帮我修改这段代码,以便用它们的起始和结束索引多次找到该模式吗?
public class BoyerMoore {
private final int R; // the radix
private int[] right; // the bad-character skip array
private String pat; // or as a string
// pattern provided as a string
public BoyerMoore(String pat) {
this.R = 256;
this.pat = pat;
// position of rightmost occurrence of c in the pattern
right = new int[R];
for (int c = 0; c < R; c++)
right[c] = -1;
for (int j = 0; j < …
Run Code Online (Sandbox Code Playgroud) java ×3
ajax ×1
algorithm ×1
boyer-moore ×1
cxf ×1
eclipse ×1
hashmap ×1
jquery ×1
jsp ×1
sorting ×1
spring ×1
spring-mvc ×1
web-services ×1