Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 删除<;回报>;soap响应中的元素-JaxWs_Java_Wsdl_Jax Ws_Wsimport - Fatal编程技术网

Java 删除<;回报>;soap响应中的元素-JaxWs

Java 删除<;回报>;soap响应中的元素-JaxWs,java,wsdl,jax-ws,wsimport,Java,Wsdl,Jax Ws,Wsimport,我有以下类,我基本上是在重新编写一些现有服务,并且必须使用“wsimport”从wsdl生成以下类。Soap响应必须完全类似于它在遗留代码中返回的方式。以下是从导入生成的类 不知何故,元素被添加到了soap响应中,我检查了我的类,但在生成的导入中没有看到。你知道怎么去掉这些吗 我在这里看到了这个解决方案,但它对我来说并不理想 package org.openuri; import javax.xml.bind.annotation.XmlAccessType; import javax.xml

我有以下类,我基本上是在重新编写一些现有服务,并且必须使用“wsimport”从wsdl生成以下类。Soap响应必须完全类似于它在遗留代码中返回的方式。以下是从导入生成的类

不知何故,
元素被添加到了soap响应中,我检查了我的类,但在生成的导入中没有看到。你知道怎么去掉这些吗

我在这里看到了这个解决方案,但它对我来说并不理想

package org.openuri;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import net.tds.msa.address.addressvalues.Values;

/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType>
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element ref="{http://xx.net/msa/Address/AddressValues.xsd}AddressValuesResponse"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "addressValuesResponse"
})
@XmlRootElement(name = "getPostDirectionalResponse")

public class GetPostDirectionalResponse {

@XmlElement(name = "AddressValuesResponse", namespace = "http://xx.net/msa/Address/AddressValues.xsd", required = true)
protected Values addressValuesResponse;

/**
 * Gets the value of the addressValuesResponse property.
 * 
 * @return
 *     possible object is
 *     {@link Values }
 *     
 */
public Values getAddressValuesResponse() {
    return addressValuesResponse;
}

/**
 * Sets the value of the addressValuesResponse property.
 * 
 * @param value
 *     allowed object is
 *     {@link Values }
 *     
 */
public void setAddressValuesResponse(Values value) {
    this.addressValuesResponse = value;
}
* * * *列表中允许以下类型的对象 *{@link AddressValue} * * */ 公共列表getAddressValue(){ 如果(addressValue==null){ addressValue=新的ArrayList(); } 返回此.addressValue; } } 响应是添加
元素的地方。我如何在不使用jaxws中的soap处理程序的情况下删除它

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns3:getPostDirectionalResponse xmlns:ns2="http://xx.net/msa/Address/AddressValues.xsd" xmlns:ns3="http://openuri.org/">
         <ns2:AddressValuesResponse>
            <AddressValue>hello</AddressValue>
         </ns2:AddressValuesResponse>
      </ns3:getPostDirectionalResponse>
   </S:Body>
</S:Envelope>

南方
s

在服务端点界面中,将
@SOAPBinding(parameterStyle=parameterStyle.BARE)
添加到
@WebMethod

@WebService(serviceName = "MyService")
public class MyService{

@WebResult(header = true, name = "ResponseLastWrapperElement", targetNamespace = "")
这将
getPostDirectionalResponse
元素的生成模式(对于我)更改为:


并且生成的soap响应是裸的(未包装,无
):



-服务操作只能有一个参数/输入。

嗨,我遇到了同样的问题,我的解决方案是:

在webservice文件中

//服务的内容


我希望这对更多的人有用

太棒了!这很有魅力,我不得不稍微调整一下服务,但效果完美。对我来说很有效。谢谢
package org.openuri;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;

@WebService
public interface ExampleService {

    @WebMethod
    @SOAPBinding(parameterStyle=ParameterStyle.BARE)
    GetPostDirectionalResponse getPostDirectional(String input);
}
<xs:element name="getPostDirectionalResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="AddressValuesResponse" type="tns:values" form="qualified"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns3:getPostDirectionalResponse xmlns:ns2="http://xx.net/msa/Address/AddressValues.xsd" xmlns:ns3="http://openuri.org/">
         <ns2:AddressValuesResponse>
            <AddressValue>hello</AddressValue>
         </ns2:AddressValuesResponse>
      </ns3:getPostDirectionalResponse>
   </S:Body>
</S:Envelope>
@WebService(serviceName = "MyService")
public class MyService{

@WebResult(header = true, name = "ResponseLastWrapperElement", targetNamespace = "")