cuiweibing229

积分:60
发表主题:56
|
| 发表于 2009-06-23 17:29 资料 |
楼主 |
本人最近在学习Axis2 1.5,看到部署ADB的例子时,我自己写了个例子.发现用wsdl2java生成的JAVA代码没有给我生成STUB代码. 我的例子如下: 我先用JAVA2wsdl生成WSDL文件. JAVA代码如下: - Java code
package com.wang.adb.util;
import java.util.HashMap;
import java.util.Map;
/**
* 这是最简单的POJO类型的WebService
* @author Administrator
*/
public class AxisTest03_adb
{
private Map<String, Float> params = new HashMap<String, Float>();
public Float getPrice(String symbol)
{
Float price = 23.43f;
Float pricemap = params.get(symbol);
if (pricemap != null)
{
price = pricemap;
}
return price;
}
public void updatePrice(String symbol, Float price)
{
Float temp = params.get("symbol");
if (temp != null)
{
temp = price;
} else
{
params.put(symbol, price);
}
}
}
生成后的WSDL代码如下: - XML code
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:ns="http://util.adb.wang.com"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://util.adb.wang.com">
<wsdl:types>
<xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://util.adb.wang.com">
<xs:element name="updatePrice">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="symbol"
nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="price"
type="xs:float" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPrice">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="symbol"
nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPriceResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return"
type="xs:float" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="getPriceRequest">
<wsdl:part name="parameters" element="ns:getPrice" />
</wsdl:message>
<wsdl:message name="getPriceResponse">
<wsdl:part name="parameters" element="ns:getPriceResponse" />
</wsdl:message>
<wsdl:message name="updatePriceRequest">
<wsdl:part name="parameters" element="ns:updatePrice" />
</wsdl:message>
<wsdl:portType name="AxisTest03_adbPortType">
<wsdl:operation name="getPrice">
<wsdl:input message="ns:getPriceRequest"
wsaw:Action="urn:getPrice" />
<wsdl:output message="ns:getPriceResponse"
wsaw:Action="urn:getPriceResponse" />
</wsdl:operation>
<wsdl:operation name="updatePrice">
<wsdl:input message="ns:updatePriceRequest"
wsaw:Action="urn:updatePrice" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AxisTest03_adbSoap11Binding"
type="ns:AxisTest03_adbPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="updatePrice">
<soap:operation soapAction="urn:updatePrice"
style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
</wsdl:operation>
<wsdl:operation name="getPrice">
<soap:operation soapAction="urn:getPrice" 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="AxisTest03_adbSoap12Binding"
type="ns:AxisTest03_adbPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="updatePrice">
<soap12:operation soapAction="urn:updatePrice"
style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
</wsdl:operation>
<wsdl:operation name="getPrice">
<soap12:operation soapAction="urn:getPrice"
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="AxisTest03_adbHttpBinding"
type="ns:AxisTest03_adbPortType">
<http:binding verb="POST" />
<wsdl:operation name="updatePrice">
<http:operation location="AxisTest03_adb/updatePrice" />
<wsdl:input>
<mime:content type="text/xml" part="updatePrice" />
</wsdl:input>
</wsdl:operation>
<wsdl:operation name="getPrice">
<http:operation location="AxisTest03_adb/getPrice" />
<wsdl:input>
<mime:content type="text/xml" part="getPrice" />
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getPrice" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AxisTest03_adb">
<wsdl:port name="AxisTest03_adbHttpSoap11Endpoint"
binding="ns:AxisTest03_adbSoap11Binding">
<soap:address
location="http://localhost:8080/axis2/services/AxisTest03_adb" />
</wsdl:port>
<wsdl:port name="AxisTest03_adbHttpSoap12Endpoint"
binding="ns:AxisTest03_adbSoap12Binding">
<soap12:address
location="http://localhost:8080/axis2/services/AxisTest03_adb" />
</wsdl:port>
<wsdl:port name="AxisTest03_adbHttpEndpoint"
binding="ns:AxisTest03_adbHttpBinding">
<http:address
location="http://localhost:8080/axis2/services/AxisTest03_adb" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
然后我又用wsdl2java生成了java代码,主要是用来远程调用. 命令如下: wsdl2java -uri AxisTest03_adb.wsdl -d adb -s -ss -sd -ssi -o src(主要是这个) 不知道为啥我生成的文件中没有类似STUB的代码. 只有8个文件 AxisTest03_adbMessageReceiverInOnly.java,AxisTest03_adbMessageReceiverInOut.java,AxisTest03_adbSkeleton.java AxisTest03_adbSkeletonIntece.java,ExtensionMapper.java,GetPrice.java,GetPriceResponse.java,UpdatePrice.java 请高手们指点小弟一下..急!!!!
|
|
|
|
|