# Garoon SOAP API と 外部システム(イントラマート)連携での問題

**URL:** <https://community.cybozu.dev/t/topic/3513>\
**Category:** Garoon カスタマイズ\
**Created:** [2018 年 11 月 8 日午前 1:13 UTC](https://community.cybozu.dev/t/topic/3513 "2018-11-08T01:13:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Legacy\_Account888](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@Legacy\_Account888](https://community.cybozu.dev/u/Legacy_Account888)\
**Post date:** [2018 年 11 月 8 日午前 1:13 UTC](https://community.cybozu.dev/t/topic/3513/1 "2018-11-08T01:13:19Z")

</div>

こんにちは！

現在JAVAで構築されたイントラマートのプロジェクトでガルーンのサービスに連携し、ガルーンのユーザー情報取得、更新、追加、メッセージ送信などの行おうとしております。

&nbsp;

そこで、以下URLに載っている「ユーザー／アドレス帳を操作する」サンプルソースを試してみました。

[https://developer.cybozu.io/hc/ja/articles/202228424](https://developer.cybozu.io/hc/ja/articles/202228424)

まずコマンドプロンプトでの動作を確認してから上記で提供しているgaroon3api.jarを現在開発しているプロジェクトに取り入れ、JAVAアプリケーションでの実行を行い、欲しいサービスを呼出してレスポンスをもらうことに成功しました。

&nbsp;

その後、イントラマートの処理を経由して（ある処理の続きで）上記と全く同じ方法でサービスを呼出すと以下のエラーになってしまいます。

Caused by: java.lang.NullPointerException  
at org.apache.axiom.soap.impl.llom.RolePlayerChecker.checkHeader(SOAPHeaderImpl.java:113)  
at org.apache.axiom.soap.impl.llom.SOAPHeaderImpl$HeaderIterator.checkHeader(SOAPHeaderImpl.java:192)  
at org.apache.axiom.soap.impl.llom.SOAPHeaderImpl$HeaderIterator.\<init\>(SOAPHeaderImpl.java:180)  
at org.apache.axiom.soap.impl.llom.SOAPHeaderImpl.getHeadersToProcess(SOAPHeaderImpl.java:293)  
at org.apache.axis2.handlers.addressing.AddressingInHandler.invoke(AddressingInHandler.java:116)  
at org.apache.axis2.engine.Phase.invoke(Phase.java:317)  
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)  
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)  
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:363)  
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)  
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)  
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)  
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)  
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)  
at com.cybozu.garoon3.common.CBServiceClient.sendReceive(CBServiceClient.java:142)  
at jp.co.itec.hhgw.garoon.AdminService.getUserInfo(AdminService.java:124)  
at jp.co.itec.hhgw.garoon.SendMessageProcess.execute(SendMessageProcess.java:55)  
at jp.co.intra\_mart.system.workflow.plugin.process.arrive.ArriveProcessJavaExecutorEvent.execute(ArriveProcessJavaExecutorEvent.java:96)  
… 9 more

&nbsp;

ネットで調べてみるとヘッダーに名前空間を入れなかった場合に

Namespace取得に失敗し、上記のエラーになるとのことを見つけました。

[https://translate.google.com/translate?hl=ja&sl=en&u=https://wso2.org/jira/browse/ESBJAVA-559&prev=search](https://translate.google.com/translate?hl=ja&sl=en&u=https://wso2.org/jira/browse/ESBJAVA-559&prev=search)

&nbsp;

だけど処理失敗する時に渡しているヘッダータグは以下でして「xmlns:soapenv」をつけています。

※サンプルソースのCBServiceClientで作成してますね。

\<soapenv:Header xmlns:soapenv="[http://www.w3.org/2003/05/soap-envelope"\>\<Action](http://www.w3.org/2003/05/soap-envelope%22%3E%3CAction) xmlns="[http://schemas.xmlsoap.org/ws/2003/03/addressing"\>AdminGetUserDetailByIds\</Action\>\<Security](http://schemas.xmlsoap.org/ws/2003/03/addressing%22%3EAdminGetUserDetailByIds%3C/Action%3E%3CSecurity) xmlns="[http://schemas.xmlsoap.org/ws/2002/12/secext"\>\<UsernameToken\>\<Username\>intra-mart\</Username\>\<Password\>hhgw1234\</Password\>\</UsernameToken\>\</Security\>\<Timestamp](http://schemas.xmlsoap.org/ws/2002/12/secext%22%3E%3CUsernameToken%3E%3CUsername%3Eintra-mart%3C/Username%3E%3CPassword%3Ehhgw1234%3C/Password%3E%3C/UsernameToken%3E%3C/Security%3E%3CTimestamp) xmlns="[http://schemas.xmlsoap.org/ws/2002/07/utility"\>\<Created\>2018-11-07T16:18:08Z\</Created\>\<Expires\>2037-12-31T00:00:00Z\</Expires\>\</Timestamp\>\</soapenv:Header](http://schemas.xmlsoap.org/ws/2002/07/utility%22%3E%3CCreated%3E2018-11-07T16:18:08Z%3C/Created%3E%3CExpires%3E2037-12-31T00:00:00Z%3C/Expires%3E%3C/Timestamp%3E%3C/soapenv:Header)\>

&nbsp;

処理に成功する場合（JAVAアプリケーションで実行：main(String[] args)）と

処理に失敗する場合（ガルーンサービスを呼出すクラスを作成して、IM処理を経由：イントラマートの処理後、該当メソッドを呼び出す形）で

CBServiceClientのserviceClient.sendReceive(request);を実行するタイミングでの持っている値や引数は全く同じです。

&nbsp;

処理に失敗する理由についてもし心当たりがありましたら教えて頂けますでしょうか。

&nbsp;
