Error using SoapClient() in PHP - soap

I'm trying to access WSDL(Web Service Definition Language) file using SoapClient() of PHP. I found that WSDL file is authenticated. I tried with passing credentials on an array by another parameter and active SSL on my server, still I'm getting an error.
Here is the code I'm using:
$client = new
SoapClient("https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl",array("trace"
=> "1","Username" => "username","Password" => "password"));
Here is the error I'm getting:
Warning:
SoapClient::SoapClient(https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl)
[soapclient.soapclient]: failed to open stream: Connection timed out
in PATH_TO_FILE on line 80
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning
: failed to load external entity
"https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl"
in PATH_TO_FILE on line 80
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing
WSDL: Couldn't load from
'https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl'
: failed to load external entity
"https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl"
in PATH_TO_FILE:80 Stack trace: #0
/home2/wingstec/public_html/widget/API/index.php(80):
SoapClient->SoapClient('https://webserv...', Array) #1 {main} thrown
in PATH_TO_FILE on line 80
It seems that error says file not exist at the path we given but when we run that path directly on browser then we're getting that file
Can anyone help me to figure out what the exactly problem is?

First make sure you have the right to access website from your hosting account or server - check first if you can access a http webservice (without the s). If not, check if allow_url_fopen is set to true in php.ini.
Then, if you are trying to establish a https connection, you need a local certificate.
See if you can add one and instantiate your Soap object using something like
new SoapClient($wsdl, array('local_cert' => $pathToLocalCert));

Related

How to establish a server with a unix domain socket

I am trying to establish a server with OCaml using a unix domain socket. I tried the following:
let sock_addr = Unix.ADDR_UNIX sock_file_path in
Unix.establish_server server_loop sock_addr;
With sock_file_path being a path to a .sock file.
But I always get one of the following errors:
if the file in sock_file_path doesn't exist, the exception Unix.EPERM is raised (Operation not permitted).
if the file in sock_file_path exists and is just an empty file, the exception Unix.EADDRINUSE is raised (Address already in use).
In both cases, it is the call to bind that raises the exception in Unix.establish_server.
Is there a particular way in which the file needs to be initialized for it to work?

SOAP API Automating testing with ROBOTFRAMEWORK

Good day,
I am trying to use robot framework to test a soap based api. I tried using the RobotFramework-Soap library first. I tried a sample case and it works but as soon as I put in my api link it does not work. Im not sure if it is because my api link contains an api.
N.B. due to confidentiality I am unable to post the actual api link. But it is in the format shown below.
*** Settings ***
Library SoapLibrary
Library OperatingSystem
*** Test Cases ***
Example
Create Soap Client http://000.000.000.000:8000/SomeService?wsdl
${response} Call SOAP Method With XML ${CURDIR}/request.xml
${text} Get Data From XML By Tag ${response} AddResult
Log To Console ${text}
Save XML To File ${response} ${CURDIR} response_test
When I run the above test. It fails with following error:
ConnectionError: HTTPConnectionPool(host='xxx_cert', port=8000): Max retries exceeded with url: /SomeService?xsd=xsd0 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
I even tried using the suds library as well. and when i do a simple test as follows:
***Test Cases***
Example
Create Soap Client http://000.000.000.000:8000/SomeService?wsdl
I get the following error: URLError: urlopen error [Errno 11001] getaddrinfo failed
I did some searching and I found that it could be related to the port. But Im not sure how to resolve this issue.
Any assistance would be greatly appreciated.
Thanks,
Lee
The solution was to edit the local host file to cater for the web service. That seemed to solve all the problems.

weblogic fail to start: Address already in use error

I have a test application that I created to start learn weblogic with Eclipse .
yesterday the jsp page was working well when I run as / on server , I got the basic page that I created .
but today I have an error message :
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]
in the browser I got this :
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
and an other time I got this on console :
weblogic.application.ModuleException: null
null
at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:270)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
Truncated. see log file for complete stacktrace
can you explain to me what I miss , when I start the server it has the status started . thank you I can add any information .
The most probable cause is server running in debug mode and having the same debug port as an existing server on same machine.
If you have multiple domains configured for each domain running in development mode on the same machine make sure DEBUG_PORT in the setDomainEnv script has different values.
If you have multiple managed servers on the same domain and same machine, create a separate startManagedWeblogic script to start your managed servers and set the Debug Port in that script.
If you use Node Manager to start your managed servers, make sure you have the following lines set in your nodemanager.properties file, otherwise etDomainEnv.sh won't be executed:
StartScriptEnabled=true
StopScriptEnabled=true
This way, if you start the Managed Server via the Admin Console, setDomainEnv.sh will get called.
Then, you can modify the WebLogic domain script setDomainEnv.sh to set the proper DEBUG_PORT value according to the server name that needs to be started:
Use your favourite editor to change the setDomainEnv.sh file
You should find the following lines already :
if [ "${SERVER_NAME}" = "" ] ; then
SERVER_NAME="AdminServer"
export SERVER_NAME
fi
The same way, you can add :
if [ "${SERVER_NAME}" = "ManagedServer1" ] ; then
DEBUG_PORT="8454"
export DEBUG_PORT
fi
if [ "${SERVER_NAME}" = "ManagedServer2" ] ; then
DEBUG_PORT="8455"
export DEBUG_PORT
fi

Running Play 2.4.x Locally Yields: java.lang.IllegalArgumentException: port out of range:-1

While trying to start my Play app locally I am getting a
java.lang.IllegalArgumentException: port out of range:-1
exception followed by a
(*:playRun) java.lang.reflect.InvocationTargetException
message. I can see in the trace the invalid port arg being sent (..../Scala/launcher/sbt-launch.jar" xsbt.boot.Boot "~run -1") but cannot find where to update this argument. There has to be somewhere to override default values. And... No matter what is in the application.conf (http.port) or what I pass on the command line -Dhttp.port I still get the same error. Any info would be enormously appreciated.
I had the same exception and I was in touch with the IntelliJ support team, and got the message it was a bug, because of the https protocol in the open browser field. The url parser cannot handle https and thus not extract the port number.
Bug report here: https://youtrack.jetbrains.com/issue/SCL-9971

No connection could be made because the target machine actively refused it 127.0.0.1:25

I get this error while running web services using a web application.
No connection could be made because the target machine actively refused it 127.0.0.1:8083
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8083
Source Error:
Line 108: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/VerifyFingerPrint", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 109: public string VerifyFingerPrint([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] VeriBmp, string empcode) {
Line 110: object[] results = this.Invoke("VerifyFingerPrint", new object[] {
Line 111: VeriBmp,
Line 112: empcode});
Source File: D:\Mayuri1working\BOBFingerPrint\BOBFingerPrint\Web References\localhost\Reference.cs Line: 110
Please help !
First update your web service references used in your application.
If web service references are not get updated, then check all files and folder containing source code files in your web service project solution and rebuild it and then update web references used in your project.
Else if its working fine then you need to check your network services used by your development server and windows firewall settings as suggested in above solutions.
I also encountered same problem and I came to know that I was referencing wrong folder having same name but used in another solution.
Enjoy codding.