- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我的 eclipse 中有 Java WebService 代码。我用过@WebService @Webmethod、@XmlElements、@XmlType、@XmlAccessorType
现在我正在使用来自 cxf 框架的 java2ws 命令生成 wsdl。这是命令
F:\....\code\java2wsdl>java2ws -o CustomerVxRR.wsdl -d <myOutputDir> -wsdl -cp <myClassesFolder> <ServiceImpl class>
我的 wsdl 文件 contqins agr0 作为我不想要的名称,因为当我将它导入 SoapUI 时。它在字段周围添加标签。
这是带有 arg0 的 wsdl 部分
<xs:schema ..... >
<xs:complexType name="myServiceMethodName">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="tns:ServiceInputClassName"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ServiceInputClassName">
<xs:sequence>
<xs:element minOccurs="0" name="EmpID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xz:schema>
这里是在SOAPUI中生成的请求对象
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://customeroffer.manage.ws.hello.my.com/">
<soapenv:Header/>
<soapenv:Body>
<cus:myServiceMethodName>
<!--Optional:-->
<arg0>
<EmpID >123456</EmpID>
</arg0>
</cus:myServiceMethodName>
</soapenv:Body>
</soapenv:Envelope>
如果我删除标签,我会得到这样的响应:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: unexpected element (uri:"", local:"EmpID"). Expected elements are <{}empid></faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
我不想在请求 XML 中保留 arg0
最佳答案
我只是在研究了自己的代码后才修复它。唯一需要改变的东西<arg0>
是我们需要使用 @WebParam
用于声明客户名称而不是“arg0”的注释。
例如:
我的服务名称是 getEmpDetail 并且 EmpID 是服务的输入参数然后这里是服务实现类中所需的声明:
public Emp getEmpDetail(@WebParam(name="EmpDetail") String EmpId)
从 WSDL 生成后,请求 XML 将如下所示
<ns:getEmpDetail>
<EmpDetail>
<EmdID>?</EmpID>
</EmpDetail>
<ns:getEmpDetail>
关于java - 摆脱 <arg0>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23475189/
我有这个代码。为了让它工作,我必须使用 Args&&... 而不是 Args... 或 Args&... 我注意到 args 从 & 转换为 const& 或 && 转换为 &。 Args...Arg
当我定义类时,我总是去 Class A(object): def __init__(self, arg): self.arg = arg def print_arg(s
假设我想定义两个 {Type} 类的变量。构造函数采用 1 个参数。下面两种方式是否完全等价(编译成相同的目标代码)? Type a(arg), b(arg); 和 Type a(arg); Type
(旁白:我是一名 Perl 程序员,正如您所知,这是我的第一个重要的 Java 程序。简单的术语将不胜感激。) 我有以下启动器作为编码工作: import java.lang.reflect.*; i
Math.nextUp(arg) 始终与 arg + Math.ulp(arg) 相同,还是我遗漏了什么? System.out.println( 0.5 + Math.ulp(0.5));
今天我在学习完美转发,我创建了这个代码示例 #include #include template auto toStdFun(Function&& fun, Args&&...ar
我想知道你会选择哪个选项? putStrLn (show randomNum) putStrLn $ show randomNum (putStrLn . show) randomNum 所有选项在语
我试图在 visual studio 2012 中编译一个库,它最初是用 c++ 为 visual studio 2015 编写的。我有一个错误说 'class' missing tag。 错误消息的
我在下面的代码中遇到了运行时异常ArrayIndexOutOfBoundException,行中: if ( args[0].equals("t") || args[0].equals("time")
我有以下代码 import React, { Component } from "react"; import { Accounts } from "meteor/accounts-base"; ex
这个问题已经有答案了: Difference between Arrays and 3 dots (Varargs) in java (3 个回答) 已关闭 5 年前。 受学校线性代数 I 和 II
所以我定义了一个函数: def getDistnace(self, strings, parentD, nodeName, nodeDistance): 我用它来调用: Node.getDistnac
这个问题在这里已经有了答案: subprocess.call() arguments ignored when using shell=True w/ list [duplicate] (2 个答案
我想将参数传递给 java 应用程序,但喜欢 linux 应用程序风格。 java 中的main 方法对所有参数使用一个String 数组。在 Linux 中,大多数应用程序接受如下参数:ls -l
这是我的代码片段 #include void change(int a[]){ printf("%p\n",&a); } int main(){
我需要使用 python 3.6 subprocess.run() 函数发出以下命令: gsettings set org.gnome.shell enabled-extensions "['appl
这两个函数是否有任何有意义的不同?有什么理由通常更喜欢一个而不是另一个吗? void foo(auto x, auto &... y) { /* ... */ } template void foo(
例如: def m(arg, ...args) { println "arg: $arg" println "args: $args" } m('arg', k:'v') 输出: ar
我对 Java 还很陌生。目前正在尝试将 args[] 中给出的文件名传递给此 FileReader,但当我编译时,它说找不到指定的文件。如果我对文件名进行硬编码,它就可以正常工作。这应该如何运作?
为什么这是一个语法错误??做这件事的合适方法是什么? >>> def f(*args, option=None): File "", line 1 def f(*args, option=
我是一名优秀的程序员,十分优秀!