小编Suj*_*jan的帖子

使用Apache CXF的Web服务响应显示"没有绑定操作信息.."

问题描述可能很长.请耐心等待并提供任何帮助,因为我不熟悉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)

java eclipse web-services cxf

14
推荐指数
3
解决办法
6万
查看次数

如何通过ajax从spring控制器获取数据?

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在视图页面上接收这些数据吗?

ajax jquery spring jsp spring-mvc

7
推荐指数
1
解决办法
4万
查看次数

HashMap应该是未分类的,但仍然按键排序

根据这些:

  1. http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html
  2. HashMap,LinkedHashMap和TreeMap之间的区别
  3. java beginner:密钥如何在哈希映射中排序?

HashMapJava应该是未排序的,但它被相对于分类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)

java sorting hashmap data-structures

4
推荐指数
1
解决办法
3168
查看次数

修改Boyer Moore以进行多种模式搜索

我根据这个网站使用过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 algorithm boyer-moore

3
推荐指数
1
解决办法
4346
查看次数