Jump to content

Soap access question


Jake A
 Share

Recommended Posts

I'm having trouble accessing the pbx database via soap, per the wiki's instructions at http://wiki.pbxnsip.com/index.php/Access_to_the_Database.

 

I've tried accessing the db the following ways:

Custom java app built to the specs on the wiki

Manual socket connection with netcat

The example php script (both original and modified)

 

I'm running version 2.0.3.1705 on a windows machine. I get no response once the soap request is sent. Does the interface require authentication? If so there is no indication that it does and no documentation on how to authenticate. I've tried opening a session to the web interface and sending the cookie with the soap request, but that didn't work either. Is there any formal documentation available (or a known good, working example)?

Link to comment
Share on other sites

http://wiki.pbxnsip.com/index.php/Access_to_the_Database needs a little more updates....

 

I've tried accessing the db the following ways:

Custom java app built to the specs on the wiki

Manual socket connection with netcat

:) The example php script (both original and modified) :blink:

...I get no response once the soap request is sent.

 

If you actually don't get a response using the provided PHP script, then this would indicate that the SOAP Trusted IP is not set, or invalid (SOAP Trusted IP can be found in Settings->System under the Appearance header)

 

You will need to set the IP address or a qualifying host-name that has the SOAP client software (e.g. your computer's IP address or you can obtain a public IP address instead by going to whatismyip ).

 

If you don't see the SOAP Trusted IP field under the Appearance Header, then that means your current PBX's SOAP server is disabled. In that case, we can provide a temporary key which will enable the SOAP feature.

 

Does the interface require authentication? If so there is no indication that it does and no documentation on how to authenticate. I've tried opening a session to the web interface and sending the cookie with the soap request, but that didn't work either. Is there any formal documentation available (or a known good, working example)?

Using the SOAP Trusted IP is an alternative "Credential", and you should not need to set the credentials, cookies and any other objects, but applying "Default Credentials" and sending cookies will not cause an error (At least on the C++ and Visual Basic side).

 

Is there any formal documentation available (or a known good, working example)?

 

In regards to the SOAP reference and overall pbxnsip admin/user manual, we actually are in the process of updating more easy-to-understand technical and non-technical details and illustration to the documentation of the next stable release...

 

As I said earlier, http://wiki.pbxnsip.com/index.php/Access_to_the_Database pretty much explains the basics of the PBX database function (the php source code there is a known, good working example), except we neglected to mention about the SOAP Trusted IP address part.

 

If you still have trouble getting a response, try the following request in php:

$max=10;

for( $i=0; i<$max; #i++ )

{

$request = "<Table>domain_alias</Table><Index>"+ max + </Index><Column><Name>name</Name></Column>";

 

echo "Existing Domain ID: " + pbx_soap( pbx_envelope( "DBGet", $request );

}

 

Check back with it soon, and you will also see the DBIndex function to aid you in the implementation process. The database feature is NOT the only thing we provide in SOAP calls, but there are also much more SOAP features to be tested and documented.

 

Important note:

 

Using socket programming is fine for PHP or other scripting language, but it has been a known issue that socket programming cannot be correctly implemented from a programming language e.g. C++, Visual Basic, etc.. A work around for this is to use the provided web service implementation, for instance, in C++/Visual Basic use the HTTPWebRequest and HTTPWebResponse, and in Java, use the

Happy Coding :D

Link to comment
Share on other sites

http://wiki.pbxnsip.com/index.php/Access_to_the_Database needs a little more updates....

 

I've tried accessing the db the following ways:

Custom java app built to the specs on the wiki

Manual socket connection with netcat

:) The example php script (both original and modified) :blink:

...I get no response once the soap request is sent.

 

If you actually don't get a response using the provided PHP script, then this would indicate that the SOAP Trusted IP is not set, or invalid (SOAP Trusted IP can be found in Settings->System under the Appearance header)

 

You will need to set the IP address or a qualifying host-name that has the SOAP client software (e.g. your computer's IP address or you can obtain a public IP address instead by going to whatismyip ).

 

If you don't see the SOAP Trusted IP field under the Appearance Header, then that means your current PBX's SOAP server is disabled. In that case, we can provide a temporary key which will enable the SOAP feature.

 

Does the interface require authentication? If so there is no indication that it does and no documentation on how to authenticate. I've tried opening a session to the web interface and sending the cookie with the soap request, but that didn't work either. Is there any formal documentation available (or a known good, working example)?

Using the SOAP Trusted IP is an alternative "Credential", and you should not need to set the credentials, cookies and any other objects, but applying "Default Credentials" and sending cookies will not cause an error (At least on the C++ and Visual Basic side).

 

Is there any formal documentation available (or a known good, working example)?

 

In regards to the SOAP reference and overall pbxnsip admin/user manual, we actually are in the process of updating more easy-to-understand technical and non-technical details and illustration to the documentation of the next stable release...

 

As I said earlier, http://wiki.pbxnsip.com/index.php/Access_to_the_Database pretty much explains the basics of the PBX database function (the php source code there is a known, good working example), except we neglected to mention about the SOAP Trusted IP address part.

 

If you still have trouble getting a response, try the following request in php:

$max=10;

for( $i=0; i<$max; #i++ )

{

$request = "<Table>domain_alias</Table><Index>"+ max + </Index><Column><Name>name</Name></Column>";

 

echo "Existing Domain ID: " + pbx_soap( pbx_envelope( "DBGet", $request );

}

 

Check back with it soon, and you will also see the DBIndex function to aid you in the implementation process. The database feature is NOT the only thing we provide in SOAP calls, but there are also much more SOAP features to be tested and documented.

 

Important note:

 

Using socket programming is fine for PHP or other scripting language, but it has been a known issue that socket programming cannot be correctly implemented from a programming language e.g. C++, Visual Basic, etc.. A work around for this is to use the provided web service implementation, for instance, in C++/Visual Basic use the HTTPWebRequest and HTTPWebResponse class, and in Java, use the HttpServletRequest HttpServletResponse class.

 

Happy Coding :D

Link to comment
Share on other sites

  • 1 year later...

This post was of great help to me, once the licence was updated the Trusted IP option became visible.

This works perfectly!

 

But ... is there any way to add more then one Trusted IP adress?

I'm finding myself in the position where I need several applications to gain access to the PBX.

And of course those applications are on multiple servers ...

 

Thanx!

Link to comment
Share on other sites

But ... is there any way to add more then one Trusted IP adress?

I'm finding myself in the position where I need several applications to gain access to the PBX.

And of course those applications are on multiple servers ...

 

Just enter the list of IP addresses, seperated by space characters.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...