Apache AXIS
JWS
.java ファイルを拡張子を .jws として axis のディレクトリにコピーする
だけで利用できる。パッケージは使えない。
簡単な設定と実行 AdminClient を利用
C:\usr\local\axis-1_4 \samples\userguide\example3>java -cp %AXISCLASSPATH%;. org.
apache.axis.client.AdminClient -lhttp://localhost:8181/axis/services/AdminServic
e deploy.wsdd
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
ファイルdeploy.wsddの処理中 / [en]-(Processing file deploy.wsdd)
<Admin>処理を実行しました / [en]-(Done processing)</Admin>
C:\usr\local\axis-1_4>java -cp %AXISCLASSPATH%;. samples.userguide.example3.Clie
nt -lhttp://localhost:8181/axis/services/MyService "test me!"
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
You typed : test me!
deploy に使用した wsdd ファイル
C:\usr\local\axis-1_4>type samples\userguide\example3\deploy.wsdd
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="MyService" provider="java:RPC">
<parameter name="className" value="samples.userguide.example3.MyService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
サービスの一覧
C:\usr\local\axis-1_4>java -cp %AXISCLASSPATH%;. org.apache.axis.client.AdminCli
ent -lhttp://localhost:8181/axis/services/AdminService list
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
<ns1:deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.
apache.org/axis/wsdd/providers/java" xmlns:ns1="http://xml.apache.org/axis/wsdd/
">
<ns1:globalConfiguration>
<ns1:parameter name="sendMultiRefs" value="true"/>
<ns1:parameter name="disablePrettyXML" value="true"/>
<ns1:parameter name="adminPassword" value="admin"/>
<ns1:parameter name="attachments.Directory" value="C:\Tomcat 5.5\webapps\axis\
WEB-INF\attachments"/>
<ns1:parameter name="dotNetSoapEncFix" value="true"/>
<ns1:parameter name="enableNamespacePrefixOptimization" value="false"/>
<ns1:parameter name="sendXMLDeclaration" value="true"/>
<ns1:parameter name="sendXsiTypes" value="true"/>
<ns1:parameter name="attachments.implementation" value="org.apache.axis.attach
ments.AttachmentsImpl"/>
<ns1:requestFlow>
<ns1:handler type="java:org.apache.axis.handlers.JWSHandler">
<ns1:parameter name="scope" value="session"/>
</ns1:handler>
<ns1:handler type="java:org.apache.axis.handlers.JWSHandler">
<ns1:parameter name="scope" value="request"/>
<ns1:parameter name="extension" value=".jwr"/>
</ns1:handler>
</ns1:requestFlow>
</ns1:globalConfiguration>
<ns1:handler name="soapmonitor" type="java:org.apache.axis.handlers.SOAPMonitor
Handler">
<ns1:parameter name="wsdlURL" value="/axis/SOAPMonitorService-impl.wsdl"/>
<ns1:parameter name="serviceName" value="SOAPMonitorService"/>
<ns1:parameter name="namespace" value="http://tempuri.org/wsdl/2001/12/SOAPMon
itorService-impl.wsdl"/>
<ns1:parameter name="portName" value="Demo"/>
</ns1:handler>
:
サービスのスコープ
サーブレット、JSP のように Request, Session, Application のレベルを
設定できる。
<service name="MyService"...>
<parameter name="scope" value="value"/>
...
</service>
Handler
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<!-- define the logging handler configuration -->
<handler name="track" type="java:samples.userguide.example4.LogHandler">
<parameter name="filename" value="MyService.log"/>
</handler>
<!-- define the service, using the log handler we just defined -->
<service name="LogTestService" provider="java:RPC">
<requestFlow>
<handler type="track"/>
</requestFlow>
<parameter name="className" value="samples.userguide.example4.Service"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
Enabling remote admin
<service name="AdminService" provider="java:MSG">
<parameter name="className" value="org.apache.axis.util.Admin"/>
<parameter name="allowedMethods" value="*"/>
<parameter name="enableRemoteAdmin" value="true"/>
</service>
Services
- RPC
- Document
- Wrapped
- Message
RPC
<service ... provider="java:RPC"> or <service ... style="RPC">
Document
<service ... style="document">
public void method(PurchaseOrder po)
Wrapped
<service ... style="wrapped">
public void purchaseOrder(String item, int quantity, String description)
Message
Java object への変換を行わない指定。リクエストで渡され XML をサービス
で処理する。XML のデータ形式により以下のような受け方が出来る。
public Element [] method(Element [] bodies);
public SOAPBodyElement [] method (SOAPBodyElement [] bodies);
public Document method(Document body);
public void method(SOAPEnvelope req, SOAPEnvelope resp);
Data type mapping
xsd:base64Binary |
byte[] |
xsd:boolean |
boolean |
xsd:byte |
byte |
xsd:dateTime |
java.util.Calendar |
xsd:decimal |
java.math.BigDecimal |
xsd:double |
double |
xsd:float |
float |
xsd:hexBinary |
byte[] |
xsd:int |
int |
xsd:integer |
java.math.BigInteger |
xsd:long |
long |
xsd:QName |
javax.xml.namespace.QName |
xsd:short |
short |
xsd:string |
java.lang.String |
Exceptions
RemoteException -> SOAP Fault
RemoteException は SOAP Fault になる。
faultcode が例外クラス名となる。
Other -> wsdl:fault
RemoteException またはそのサブクラス以外の例外は wsdl:fault 要素として
返される。
送ることの出来るオブジェクトに関する制約
Java Collection classes
Hashtable 等は serializable ではあるが、.NET 等が未対応なため配列で
返すのがもっとも安全。
Axis が送れない物
Axis が送れるのは Axis Serializer が定義されたクラスのオブジェクトのみ。
Serializable だから遅れるというわけではない。
Remote Reference がダメとあるが、これは java の参照のフィールドを
送信後リファレンスとして使えないということだろう。
BeanSerializer
BeanSerializer で指示をするとユーザー定義のオブジェクトも送ることが
出来るようになる。これも、色々と制約があるだろう。
<beanMapping qname="ns:local" xmlns:ns="someNamespace"
languageSpecificType="java:my.java.thingy"/>
最終更新:2007年05月01日 03:07