Java 允许带有可选名称空间的EJB3.1WebService
我正在使用EJB3.1和NetBeans7.0来部署Web服务。我已经从XSD文件生成了类 NetBeans为此Web服务生成WSDL文件Java 允许带有可选名称空间的EJB3.1WebService,java,web-services,netbeans,jaxb,ejb,Java,Web Services,Netbeans,Jaxb,Ejb,我正在使用EJB3.1和NetBeans7.0来部署Web服务。我已经从XSD文件生成了类 NetBeans为此Web服务生成WSDL文件 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jii="http//webservice.example.de/jii" xmlns:j="http://testservice.example.de/updatecheck/j">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jii="http//webservice.example.de/jii" xmlns:j="http://testservice.example.de/updatecheck/j">
<soapenv:Header/>
<soapenv:Body>
<jii:RegisterUser>
<j:RequestHeader>
<Nonce>test</Nonce>
<UserAgent>chrome</UserAgent>
<ManualRequest>true</ManualRequest>
</j:RequestHeader>
<jii:UserName>test</jii:UserName>
<jii:UserPassword>123456</jii:UserPassword>
</jii:RegisterUser>
</soapenv:Body>
</soapenv:Envelope>
通过XML架构生成的复杂类型请求标头:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.11.07 at 10:31:16 AM MEZ
//
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for RequestHeader complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="RequestHeader">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Nonce" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="UserAgent" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ManualRequest" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RequestHeader", propOrder = {
"nonce",
"userAgent",
"manualRequest"
})
public class RequestHeader {
@XmlElement(name = "Nonce", required = true)
protected String nonce;
@XmlElement(name = "UserAgent", required = true)
protected String userAgent;
@XmlElement(name = "ManualRequest")
protected boolean manualRequest;
/**
* Gets the value of the nonce property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNonce() {
return nonce;
}
/**
* Sets the value of the nonce property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNonce(String value) {
this.nonce = value;
}
/**
* Gets the value of the userAgent property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserAgent() {
return userAgent;
}
/**
* Sets the value of the userAgent property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserAgent(String value) {
this.userAgent = value;
}
/**
* Gets the value of the manualRequest property.
*
*/
public boolean isManualRequest() {
return manualRequest;
}
/**
* Sets the value of the manualRequest property.
*
*/
public void setManualRequest(boolean value) {
this.manualRequest = value;
}
}
//
//该文件由JavaTM XML绑定体系结构(JAXB)参考实现vhudson-JAXB-ri-2.2-147生成
//看
//重新编译源架构时,对此文件的任何修改都将丢失。
//生成日期:2011.11.07墨西哥东部时间上午10:31:16
//
导入javax.xml.bind.annotation.XmlAccessType;
导入javax.xml.bind.annotation.XmlAccessorType;
导入javax.xml.bind.annotation.xmlement;
导入javax.xml.bind.annotation.XmlType;
/**
*RequestHeader复杂类型的Java类。
*
*以下架构片段指定此类中包含的预期内容。
*
*
*complexType name=“RequestHeader”>
*complexContent>
*限制基数=”{http://www.w3.org/2001/XMLSchema}任何类型“>
*序列>
*元素名称=“Nonce”类型=”{http://www.w3.org/2001/XMLSchema}字符串“/>
*element name=“UserAgent”类型=”{http://www.w3.org/2001/XMLSchema}字符串“/>
*元素名称=“手动请求”类型=”{http://www.w3.org/2001/XMLSchema}布尔“/>
*/顺序>
*/限制>
*/complexContent>
*/complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name=“RequestHeader”,proporter={
“暂时的”,
“用户代理”,
“手动请求”
})
公共类请求头{
@XmlElement(name=“Nonce”,required=true)
受保护字符串nonce;
@xmlement(name=“UserAgent”,必需=true)
受保护的字符串用户代理;
@xmlement(name=“ManualRequest”)
受保护的请求;
/**
*获取nonce属性的值。
*
*@返回
*可能的对象是
*{@link String}
*
*/
公共字符串getNonce(){
返回当前值;
}
/**
*设置nonce属性的值。
*
*@param值
*允许的对象是
*{@link String}
*
*/
公共void setNonce(字符串值){
this.nonce=值;
}
/**
*获取userAgent属性的值。
*
*@返回
*可能的对象是
*{@link String}
*
*/
公共字符串getUserAgent(){
返回用户代理;
}
/**
*设置userAgent属性的值。
*
*@param值
*允许的对象是
*{@link String}
*
*/
public void setUserAgent(字符串值){
this.userAgent=value;
}
/**
*获取manualRequest属性的值。
*
*/
公共布尔值isManualRequest(){
退货申请;
}
/**
*设置manualRequest属性的值。
*
*/
公共无效setManualRequest(布尔值){
此.manualRequest=值;
}
}
两个SOAP请求都是相同的。第一个不带名称空间,第二个带名称空间。如果我用第二个SOAP请求中的名称空间发送EJB容器,谁知道为什么EJB容器找不到参数
谢谢
@WebService(name = "TestII", serviceName = "TestService", targetNamespace = "http//webservice.example.de/jii")
@Stateless()
public class TestServiceProvider {
@WebMethod(operationName = "RegisterUser")
@WebResult(name = "RegisterUserResult", targetNamespace = "http//webservice.example.de/jii")
public RegisterUserResult registerUser(
@WebParam(name = "RequestHeader", targetNamespace = "http://testservice.example.de/updatecheck/j") @XmlElement(required = true, nillable = false) RequestHeader requestHeader,
@WebParam(name = "UserEmail", targetNamespace = "http//webservice.example.de/jii") @XmlElement(required = true, nillable = false) String userEmail,
@WebParam(name = "UserPassword", targetNamespace = "http//webservice.example.de/jii") @XmlElement(required = true, nillable = false) String userPassword) {
//logic
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.11.07 at 10:31:16 AM MEZ
//
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for RequestHeader complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="RequestHeader">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Nonce" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="UserAgent" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ManualRequest" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RequestHeader", propOrder = {
"nonce",
"userAgent",
"manualRequest"
})
public class RequestHeader {
@XmlElement(name = "Nonce", required = true)
protected String nonce;
@XmlElement(name = "UserAgent", required = true)
protected String userAgent;
@XmlElement(name = "ManualRequest")
protected boolean manualRequest;
/**
* Gets the value of the nonce property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNonce() {
return nonce;
}
/**
* Sets the value of the nonce property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNonce(String value) {
this.nonce = value;
}
/**
* Gets the value of the userAgent property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserAgent() {
return userAgent;
}
/**
* Sets the value of the userAgent property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserAgent(String value) {
this.userAgent = value;
}
/**
* Gets the value of the manualRequest property.
*
*/
public boolean isManualRequest() {
return manualRequest;
}
/**
* Sets the value of the manualRequest property.
*
*/
public void setManualRequest(boolean value) {
this.manualRequest = value;
}
}