Page 1 of 1

Cannot connect to SOAP, but can open WSDL

PostPosted:Tue Jul 19, 2011 10:03 am
by bitscorpion
Hi,
I'm new in OpenKM and installed the latest version.
I installed it as a system-service like it is described in the wiki. Listeningaddress is 0.0.0.0

The fascinating thing is, that I can access the WSDL files from the browser, but I can't connect with any client.

Any ideas?

Re: Cannot connect to SOAP, but can open WSDL

PostPosted:Tue Jul 19, 2011 5:24 pm
by jllort
Here for example is a login example with php
Code: Select all
<?php
  // Register WSDL
  $OKMAuth = new SoapClient('http://localhost:8080/OpenKM/OKMAuth?wsdl');
 
  // Login
  $token = $OKMAuth->login('okmAdmin','admin');
  echo "Token: ".$token;
 
  // Logout
  $OKMAuth->logout($token);
?>

Re: Cannot connect to SOAP, but can open WSDL

PostPosted:Mon Jul 25, 2011 12:25 pm
by bitscorpion
Thanks, I know, how to connect to an SOAP-Api.

The problem is, that this works only on localhost.
But I want to access the SOAP-API remotely from my private network => 192.168.12.20 and this doesn't work.
I can use the webinterface http://192.168.12.20:8080/OpenKM,
but I can't connect with SOAP to 192.168.12.20.

Ideas?

Re: Cannot connect to SOAP, but can open WSDL

PostPosted:Tue Jul 26, 2011 7:10 am
by jllort
Take a look here http://openkm.svn.sourceforge.net/viewv ... iew=markup
Code: Select all
bpAuth.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, host+"/OKMAuth");
I don't know exactly how it'll be in php

Re: Cannot connect to SOAP, but can open WSDL

PostPosted:Tue Jul 26, 2011 7:21 am
by pavila
Do you mean you can't run this?
Code: Select all
$OKMAuth = new SoapClient('http://192.168.12.20:8080/OpenKM/OKMAuth?wsdl');

Re: Cannot connect to SOAP, but can open WSDL

PostPosted:Sun Aug 21, 2011 2:38 pm
by noxx
I have the same issue. Runnig the php script on localhost works fine, but running it from annother computer throws "SoapFault: Could not connect to host" and terminates on line
Code: Select all
$token = $OKMAuth->login($okmid, $okmpw);
Has anyone solved it yet?

EDIT my script
Code: Select all
<?php
function importFileInOKM($file,$okmip,$okmid,$okmpw) {
  $okmurl="http://".$okmip.":8080/OpenKM/";

  $OKMAuth = new SoapClient($okmurl."OKMAuth?wsdl");
  $OKMDocument = new SoapClient($okmurl."OKMDocument?wsdl");

  // open file
  $handle = fopen($file,'rb');
  $file_content = fread($handle,filesize($file));
  fclose($handle);

  // Login
  $token = $OKMAuth->login($okmid, $okmpw);   // THE ERROR IS THROWN HERE
  $OKMDocument->createSimple($token,"/okm:root/".$file,$file_content);

  // Logout
  $OKMAuth->logout($token);
 }
 
$file="file.pdf";
//$okmip="localhost";
$okmip="105.104.103.33";
$okmid="okmAdmin";
$okmpw="admin";

importFileInOKM($file,$okmip,$okmid,$okmpw);

Re: Cannot connect to SOAP, but can open WSDL

PostPosted:Wed Aug 24, 2011 9:11 am
by pavila
This is a "feature" of JBoss WS. If you see the WSDL the methods are bounded to localhost (or 127.0.0.1) so you need to override it when you make the call. From Java it can be performed this way:
Code: Select all
bpAuth.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, host+"/OKMAuth");
You also can change this JBoss WS behabior but now I don't rememeber whith file you need to edit. Perhaps you should take a look to the JBoss forums.