2011-11-14 10 views
1

私は次のようにC#とNetDocumentsのSOAP APIを呼び出すことができます。私は、軸1.4でJavaによってNetDocumentsのSOAP APIを呼び出すときしかし、私はエラーが表示されなかっJavaでNetDocuments SOAP APIを呼び出す方法は?

// Authenticate to the NetDocuments directory service 
ndDir.Directory ndDirectory = new ndDir.Directory(); 
ndDirectory.CookieContainer = new System.Net.CookieContainer(); // enable cookie handling 
ndDirectory.Login(username, password); 

// Connect to the NetDocuments storage service 
ndStor.storage ndStorage = new ndStor.storage(); 
ndStorage.CookieContainer = ndDirectory.CookieContainer;  // share cookies with the directory service 
XmlNode searchRes = ndStorage.Search(criteria, attrList); 

:「認証なしのセッションを認証セッションがタイムアウトしましたかこの呼び出しの前に確立されていませんでした。

DirectorySoapStub stubDir = new DirectorySoapStub(new URL("https://vault.netvoyage.com/ndApi/directory.asmx"), new DirectoryLocator()); 
StorageSoapStub stubSto = new StorageSoapStub(new URL("https://vault.netvoyage.com/ndApi/storage.asmx"), new StorageLocator()); 
stubSto.setMaintainSession(true); 
stubDir.login(username, password); 

javax.xml.soap.MimeHeaders mhds = stubDir._getCall().getMessageContext().getCurrentMessage().getMimeHeaders(); 
java.util.Iterator iterator = mhds.getAllHeaders(); 
while (iterator.hasNext()) { 
    javax.xml.soap.MimeHeader mhd = (javax.xml.soap.MimeHeader)iterator.next(); 
    if ("set-cookie".indexOf(mhd.getName()) >= 0) { 
     stubSto._setProperty(mhd.getName(), mhd.getValue()); 
    } 
} 

stubSto.search(criteria, attrList); 

JavaでCookieContainerと同様のことはありますか? Axis 1.4でJavaからNetDocuments SOAP APIを呼び出すにはどうすればよいですか?

答えて

0

この質問はもう少し前に投稿されていますが、これまでNetBeansに付属のJAX-RPCプラグインを使用することでこれを実現できました。私が使ったNetBeansのバージョンはv6.8でした(JAX-RPCプラグインはNetBeansの新しいバージョンには含まれていないと思われます)。 Axisを使用しようとしたときに何か動くように苦労していることは覚えていますが、それは私にはそれに精通していないためです。

必要な手順はすべて覚えていませんが、JAX-RPCプラグインをWSDL for NetDocumentsで指定すると、APIの呼び出しに必要なすべてのクラスが設定されます。

認証を正しく処理するには、DirectorySoap_StubクラスとStorageSoap_StubクラスのSESSION_MAINTAIN_PROPERTYをtrueに設定する必要がありました。これはログイン後にセッションを維持するよう指示します。あなたは、あなたがStorageSoapオブジェクトを使用すると、DirectorySoapセッションで使用しているクッキーを知らせる必要がありStorageSoapの方法を使用したい場合は、DirectorySoapオブジェクトを経由してログインさらにSESSION_MAINTAIN_PROPERTY

、上の情報のためhttp://docs.oracle.com/cd/E19575-01/821-0177/fxybb/index.html

これを実行するには、DirectorySoapセッションからCookieJarを格納するjavax.xml.rpc.handler.Handlerを実装しました(リクエストMessageContextのプロパティ "com.sun.xml.rpc.client.http.CookieJar")。そのCookieJarをStorageSoapセッションの要求の同じプロパティーに設定します。同様のSOAPの問題で誰にも便利です

うまくいけば...

乾杯

関連する問題