【webservice】为什么是JAXBElement而不是String类型

yapituy 2009-11-04 04:51:43
wsdl是Axis2生成的,用wsimport根据wsdl生成客户端代码时,LoginInfo类中属性对应的类型不是String类型而是JAXBElement<String>,不知道是什么原因?
...全文
3484 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
iloverecenta 2010-03-06
  • 打赏
  • 举报
回复
你用的xfire?

xfire就是这样的,用axis是原始类型


java2G空间仅298元/年 2010年新春特价虚拟主机/服务器促销
全能虚拟主机1G空间/支持asp/php/asp.net3.5/mssql2000/2005/mysql
2010新年高性能比98元/年http://kindinfo.hzxiaoqu.com/info/472.html
Java高性能主机2G空间赠送1G mysql或1G mssql 支持spring/hibernate/struts任意第三方框架 tomcat6独立管理平台
2010新年超值性价比298元/年http://kindinfo.hzxiaoqu.com/info/473.html
雨天的泪1001 2010-03-06
  • 打赏
  • 举报
回复
有没有解决方案啊?
zhangyunyue 2010-01-20
  • 打赏
  • 举报
回复
我也遇到了,哎,这怎么解决啊?有好的办法了吗?
liushurong 2009-12-16
  • 打赏
  • 举报
回复
我也碰到这个问题了
yapituy 2009-11-04
  • 打赏
  • 举报
回复
java类:
package com.example.webservice.beans.xsd;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;


@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LoginInfo", propOrder = {
"administratorId",
"administratorIdCard",
"administratorMobile",
"administratorName",
"administratorPhone",
"isLogin",
"loginMsg",
"loginTime",
"ofOrganType",
"ofSuperIntendCom",
"organAdd",
"organAreaCode",
"organCnName",
"organInfoId",
"organPhone",
"organPoliceCode",
"organPoliceName",
"peopleInfoId",
"userRights"
})
public class LoginInfo {

@XmlElementRef(name = "administratorId", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> administratorId;
@XmlElementRef(name = "administratorIdCard", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> administratorIdCard;
@XmlElementRef(name = "administratorMobile", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> administratorMobile;
@XmlElementRef(name = "administratorName", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> administratorName;
@XmlElementRef(name = "administratorPhone", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> administratorPhone;
protected Boolean isLogin;
@XmlElementRef(name = "loginMsg", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> loginMsg;
@XmlElementRef(name = "loginTime", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> loginTime;
@XmlElementRef(name = "ofOrganType", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> ofOrganType;
@XmlElementRef(name = "ofSuperIntendCom", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> ofSuperIntendCom;
@XmlElementRef(name = "organAdd", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> organAdd;
@XmlElementRef(name = "organAreaCode", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> organAreaCode;
@XmlElementRef(name = "organCnName", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> organCnName;
@XmlElementRef(name = "organInfoId", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> organInfoId;
@XmlElementRef(name = "organPhone", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> organPhone;
@XmlElementRef(name = "organPoliceCode", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> organPoliceCode;
@XmlElementRef(name = "organPoliceName", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> organPoliceName;
@XmlElementRef(name = "peopleInfoId", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> peopleInfoId;
@XmlElementRef(name = "userRights", namespace = "http://beans.webservice.example.com/xsd", type = JAXBElement.class)
protected JAXBElement<String> userRights;

public JAXBElement<String> getAdministratorId() {
return administratorId;
}

public void setAdministratorId(JAXBElement<String> value) {
this.administratorId = ((JAXBElement<String> ) value);
}

public JAXBElement<String> getAdministratorIdCard() {
return administratorIdCard;
}


public void setAdministratorIdCard(JAXBElement<String> value) {
this.administratorIdCard = ((JAXBElement<String> ) value);
}


public JAXBElement<String> getAdministratorMobile() {
return administratorMobile;
}


public void setAdministratorMobile(JAXBElement<String> value) {
this.administratorMobile = ((JAXBElement<String> ) value);
}


public JAXBElement<String> getAdministratorName() {
return administratorName;
}
public void setAdministratorName(JAXBElement<String> value) {
this.administratorName = ((JAXBElement<String> ) value);
}

public JAXBElement<String> getAdministratorPhone() {
return administratorPhone;
}

public void setAdministratorPhone(JAXBElement<String> value) {
this.administratorPhone = ((JAXBElement<String> ) value);
}

public Boolean isIsLogin() {
return isLogin;
}

public void setIsLogin(Boolean value) {
this.isLogin = value;
}

public JAXBElement<String> getLoginMsg() {
return loginMsg;
}

public void setLoginMsg(JAXBElement<String> value) {
this.loginMsg = ((JAXBElement<String> ) value);
}

public JAXBElement<String> getLoginTime() {
return loginTime;
}


public void setLoginTime(JAXBElement<String> value) {
this.loginTime = ((JAXBElement<String> ) value);
}

public JAXBElement<String> getOfOrganType() {
return ofOrganType;
}

public void setOfOrganType(JAXBElement<String> value) {
this.ofOrganType = ((JAXBElement<String> ) value);
}

public JAXBElement<String> getOfSuperIntendCom() {
return ofSuperIntendCom;
}

public void setOfSuperIntendCom(JAXBElement<String> value) {
this.ofSuperIntendCom = ((JAXBElement<String> ) value);
}


public JAXBElement<String> getOrganAdd() {
return organAdd;
}


public void setOrganAdd(JAXBElement<String> value) {
this.organAdd = ((JAXBElement<String> ) value);
}

public JAXBElement<String> getOrganAreaCode() {
return organAreaCode;
}

public void setOrganAreaCode(JAXBElement<String> value) {
this.organAreaCode = ((JAXBElement<String> ) value);
}

public JAXBElement<String> getOrganCnName() {
return organCnName;
}

public void setOrganCnName(JAXBElement<String> value) {
this.organCnName = ((JAXBElement<String> ) value);
}


public JAXBElement<String> getOrganInfoId() {
return organInfoId;
}


public void setOrganInfoId(JAXBElement<String> value) {
this.organInfoId = ((JAXBElement<String> ) value);
}


public JAXBElement<String> getOrganPhone() {
return organPhone;
}


public void setOrganPhone(JAXBElement<String> value) {
this.organPhone = ((JAXBElement<String> ) value);
}


public JAXBElement<String> getOrganPoliceCode() {
return organPoliceCode;
}


public void setOrganPoliceCode(JAXBElement<String> value) {
this.organPoliceCode = ((JAXBElement<String> ) value);
}


public JAXBElement<String> getOrganPoliceName() {
return organPoliceName;
}


public void setOrganPoliceName(JAXBElement<String> value) {
this.organPoliceName = ((JAXBElement<String> ) value);
}


public JAXBElement<String> getPeopleInfoId() {
return peopleInfoId;
}



public void setPeopleInfoId(JAXBElement<String> value) {
this.peopleInfoId = ((JAXBElement<String> ) value);
}

public JAXBElement<String> getUserRights() {
return userRights;
}

public void setUserRights(JAXBElement<String> value) {
this.userRights = ((JAXBElement<String> ) value);
}

}
yapituy 2009-11-04
  • 打赏
  • 举报
回复
wsdl:第二部分

<wsdl:message name="adminLoginRequest">
<wsdl:part name="parameters" element="ns1:adminLogin"/>
</wsdl:message>
<wsdl:message name="adminLoginResponse">
<wsdl:part name="parameters" element="ns1:adminLoginResponse"/>
</wsdl:message>
<wsdl:message name="loginRequest">
<wsdl:part name="parameters" element="ns1:login"/>
</wsdl:message>
<wsdl:message name="loginResponse">
<wsdl:part name="parameters" element="ns1:loginResponse"/>
</wsdl:message>
<wsdl:message name="logoutRequest">
<wsdl:part name="parameters" element="ns1:logout"/>
</wsdl:message>
<wsdl:message name="logoutResponse">
<wsdl:part name="parameters" element="ns1:logoutResponse"/>
</wsdl:message>
<wsdl:portType name="LoginManagePortType">
<wsdl:operation name="adminLogin">
<wsdl:input message="ns1:adminLoginRequest" wsaw:Action="urn:adminLogin"/>
<wsdl:output message="ns1:adminLoginResponse" wsaw:Action="urn:adminLoginResponse"/>
</wsdl:operation>
<wsdl:operation name="login">
<wsdl:input message="ns1:loginRequest" wsaw:Action="urn:login"/>
<wsdl:output message="ns1:loginResponse" wsaw:Action="urn:loginResponse"/>
</wsdl:operation>
<wsdl:operation name="logout">
<wsdl:input message="ns1:logoutRequest" wsaw:Action="urn:logout"/>
<wsdl:output message="ns1:logoutResponse" wsaw:Action="urn:logoutResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="LoginManageSOAP11Binding" type="ns1:LoginManagePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="adminLogin">
<soap:operation soapAction="urn:adminLogin" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="login">
<soap:operation soapAction="urn:login" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="logout">
<soap:operation soapAction="urn:logout" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="LoginManageSOAP12Binding" type="ns1:LoginManagePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="adminLogin">
<soap12:operation soapAction="urn:adminLogin" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="login">
<soap12:operation soapAction="urn:login" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="logout">
<soap12:operation soapAction="urn:logout" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="LoginManageHttpBinding" type="ns1:LoginManagePortType">
<http:binding verb="POST"/>
<wsdl:operation name="adminLogin">
<http:operation location="LoginManage/adminLogin"/>
<wsdl:input>
<mime:content type="text/xml" part="adminLogin"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="adminLogin"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="login">
<http:operation location="LoginManage/login"/>
<wsdl:input>
<mime:content type="text/xml" part="login"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="login"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="logout">
<http:operation location="LoginManage/logout"/>
<wsdl:input>
<mime:content type="text/xml" part="logout"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="logout"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="LoginManage">
<wsdl:port name="LoginManageSOAP11port_http" binding="ns1:LoginManageSOAP11Binding">
<soap:address location="http://10.160.11.5:8080/crjout/services/LoginManage"/>
</wsdl:port>
<wsdl:port name="LoginManageSOAP12port_http" binding="ns1:LoginManageSOAP12Binding">
<soap12:address location="http://10.160.11.5:8080/crjout/services/LoginManage"/>
</wsdl:port>
<wsdl:port name="LoginManageHttpport" binding="ns1:LoginManageHttpBinding">
<http:address location="http://10.160.11.5:8080/crjout/services/LoginManage"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
yapituy 2009-11-04
  • 打赏
  • 举报
回复
wsdl:第一部分

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://loginmanage.example.com/xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns1="http://loginmanage.example.com" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:ns2="http://beans.webservice.example.com/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://loginmanage.example.com">
<wsdl:documentation>LoginManage</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:ax211="http://loginmanage.example.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://loginmanage.example.com/xsd">
<xs:complexType name="AdminLoginInfo">
<xs:sequence>
<xs:element minOccurs="0" name="isLogin" type="xs:boolean"/>
<xs:element minOccurs="0" name="loginMsg" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:ns="http://loginmanage.example.com" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://loginmanage.example.com">
<xs:element name="adminLogin">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="usbKey" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="password" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="machineCode" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="adminLoginResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ns0:AdminLoginInfo"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="login">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="usbKey" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="password" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="machineCode" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="clientVersion" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="loginResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ns2:LoginInfo"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="logout">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="usbKey" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="logoutResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:ax212="http://beans.webservice.example.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://beans.webservice.example.com/xsd">
<xs:complexType name="LoginInfo">
<xs:sequence>
<xs:element minOccurs="0" name="administratorId" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="administratorIdCard" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="administratorMobile" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="administratorName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="administratorPhone" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="isLogin" type="xs:boolean"/>
<xs:element minOccurs="0" name="loginMsg" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="loginTime" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="ofOrganType" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="ofSuperIntendCom" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="organAdd" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="organAreaCode" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="organCnName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="organInfoId" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="organPhone" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="organPoliceCode" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="organPoliceName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="peopleInfoId" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="userRights" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧