SOAP Protocol

270

Solutions

402

Contributors

Simple Object Access Protocol (SOAP) is a protocol specification for exchanging structured information in the implementation of web services. It uses the XML Information Set for its message format and uses other protocols, notably Hypertext Transfer Protocol (HTTP) and the Simple Mail Transfer Protocol (SMTP) for message transmission.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi,

Given the below soapclient - how can I a) check the version of tls that it is using, and b set it to 1.2 if it is not using that already?  I had assumed the browser I was using would control that side of things, but just want to double check!

$url = "https://www.SOMEURL/interface/api/report.asmx?wsdl";
//Create the client
$client = new SoapClient($url);
$datetimestamp = date("YmdHis");
$reportname = "report".$datetimestamp;

Open in new window


your help is very much appreciated!

cheers
0
CompTIA Cloud+
LVL 12
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

In attempting to consume a PHP Zend AutoDiscover SOAP Service in a .Net client using a WebRequest, I'm getting this error:

    Procedure 'ProAddRq' not present

Code:
    class Program
    {
        static void Main(string[] args)
        {       
            FileStream fileStream = new FileStream(@"C:\wamp\www\PT\Request.xml", FileMode.Open, FileAccess.Read);
            byte[] buffer = new byte[fileStream.Length];
            int count = fileStream.Read(buffer, 0, buffer.Length);
        
            WebRequest myWebRequest = WebRequest.Create(@"http://localhost/PT/PTradersvc.php#ProAddRq");
            //***********************************************************
            // If I change the request URL to this, I get the same error
            // WebRequest myWebRequest = WebRequest.Create(@"http://localhost/PT/PTradersvc.php");
            //***********************************************************
            //***********************************************************
            // If I change the request URL to this, I get the WSDL returned
            // and no error.
            // WebRequest myWebRequest = WebRequest.Create(@"http://localhost/PT/PTradersvc.php?wsdl");
            //***********************************************************
        
            myWebRequest.ContentLength = buffer.Length;
            myWebRequest.ContentType = "application/xml";
            myWebRequest.Method = "POST";

            Stream stream = 

Open in new window

0
I am making SOAP request with POST method which is having authentication added in the request header and request payload is being passed as XML String.

Below is the reference code:

package org.test.integration;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import javax.net.ssl.HttpsURLConnection;

import org.apache.commons.io.IOUtils;

public class SoapRequestTest2 {
    public static void main(String args[]) throws MalformedURLException,
    IOException {

    //Code to make a webservice HTTP request
    String responseString = "";
    String outputString = "";
    String wsURL = "https://example.com:443/fscmService/ItemServiceV2";
    URL url = new URL(wsURL);
    URLConnection connection = url.openConnection();
    HttpsURLConnection httpConn = (HttpsURLConnection)connection;
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    String xmlInput =
            "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
                     +"<soap:Body>"
                     +"<ns1:findItem xmlns:ns1=\"http://xmlns.oracle.com/apps/scm/productModel/items/itemServiceV2/types/\">"
                     + "<ns1:findCriteria xmlns:ns2=\"http://xmlns.oracle.com/adf/svc/types/\">"
                     

Open in new window

0
I have a Zend SOAP server and in my client, I set the version using this code:
    $options = array();
    $options['cache_wsdl'] = false;
    $options['soap_version'] = SOAP_1_2;
    $client = new Zend\Soap\Client("http://example.com/mysvc.php?wsdl", $options);

Open in new window

I get this exception:    
SoapFault exception: [VersionMismatch] Wrong Version

I have tried with SOAP_1_1 and SOAP_1_2 and still get the same exception.
What am I missing here?

The service is installed on a CentOS 6.9 VirtualBox with PHP 5.6.36 installed to mock our production environment. Please do not suggest that I update to PHP7+, I have no control over the production server, I'm just building a mockup for testing.

From my PHP.ini:
    Soap Client                  enabled
    Soap Server                  enabled
    
    Directive                    Local Value                Master Value
    soap.wsdl_cache                    1                        1
    soap.wsdl_cache_dir          /var/lib/php/wsdlcache        /tmp
    soap.wsdl_cache_enabled            1                        1
    soap.wsdl_cache_limit              5                        5
    soap.wsdl_cache_ttl             86400                     86400

Open in new window

0
I'm trying to make a SOAP connection to a remote server that is enforcing TLS 1.2.  I'm getting a "SECURITY VIOLATION" error, which is due to the connection not going over TLS (according to the remote host).  

I tried adding SSLContext, but that doesn't seem to do the trick.  Can anyone point me in the right direction?




    private static void callSoapWebService(String soapEndpointUrl, String soapAction) {
        try {
            SSLContext sc = SSLContext.getInstance("TLSv1.2");
            sc.init(null, null, new java.security.SecureRandom());
            // Create SOAP Connection
            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();

            // Send SOAP Message to SOAP Server
            SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(soapAction), soapEndpointUrl);

            // Print the SOAP Response
            System.out.println("Response SOAP Message:");
            soapResponse.writeTo(System.out);
            System.out.println();

            soapConnection.close();
        } catch (Exception e) {
            System.err.println("\nError occurred while sending SOAP Request to Server!\nMake sure you have the correct endpoint URL and SOAPAction!\n");
            e.printStackTrace();
        }
    }
0
When communicating with SSAS msmdpump via SOAP requests Analysis services returns with Content-Types that are compressed and in binary XML (Content_type: xs+xpress).

We would like to include an extra layer of abstraction between the client and Analysis services and would like to know if there is a way to have Analysis services send back plain XML or how to read the xs+xpress content-types.
0
Hello,

I need to use a SOAP interface of the Dogana in Italy.
I develop some code in delphi (berlin) using SOAPHTTPClient, but i become always this error:

"Impossibile passare dalla codifica corrente a quella specificata.
Line: 1
<?xml version="1.0" encoding="utf-8"?><s."

I try
HTTPRIO.Converter.Options:=HTTPRIO.Converter.Options+[soUTF8InHeader];
HTTPRIO.Converter.Options:=HTTPRIO.Converter.Options+[soUTF8EncodeXML];
HTTPRIO.HTTPWebNode.UseUTF8InHeader:=true;
HTTPRIO.Converter.Encoding := 'UTF-8';

Thank you for the help.

Andreas
0
I'm trying to build a server for another soap server to call and give back a soap response in PHP and NuSoap.

The soap service that will be sending the request is here https://supplieruatsp.testpartstrader.us.com/v2.0/services/InventoryOptionsService.svc
Now, this service will send me a request that I'm supposed to parse, then query some data and send back a response.

I have built a simple server and client for testing but I'm getting nowhere, nothing but errors from NuSoap. I am also seeing this as an error:
wsdl error: Bad path to WSDL file ://IBMSSimpleTypes.xsd

I cannot find IBMSSimpleTypes in any file on my local web server.

Not sure what the problem is as I have never written this in PHP before.

Can anyone help out here?


Server:
<?php
require_once "./lib/nusoap.php";

$server = new soap_server('InventoryOptionsService.wsdl'); // contains a local copy of the wsdl from the service

$server->service(file_get_contents("php://input"));

    function SubmitInventory($request) {
        echo $request;
        exit;
}        

Open in new window


Client
<?php
require_once "./lib/nusoap.php";
$client = new nusoap_client("InventoryOptionsService.wsdl", true);

$error = $client->getError();
if ($error) {
    echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}
$request = file_get_contents("RequestExample.xml");

$result = $client->call("SubmitInventory", $request);

if ($client->fault) {
    echo "<h2>Fault</h2><pre>";
    print_r($result);
    

Open in new window

0
I have the following JavaScript making a call to a PHP page:

	function callPhpAPI(youdata) {
	
		$.post( "http://www.utahkidsfoundation.com/recsoap.php", { mes: youdata } );
	
	}

Open in new window



PHP page:

<?php

$mes=$_REQUEST['mes'];


    $emailto = 'xxx@gmail.com';
    $toname = 'Tom';
    $emailfrom = 'xxxr@xxx.com';
    $fromname = 'xxx';
    $subject = 'activity on xxx detected:  ' + $mes;
    $messagebody = 'There was a page hit on xxx:  ' + $mes;
    $headers = 
        'Return-Path: ' . $emailfrom . "\r\n" . 
        'From: ' . $fromname . ' <' . $emailfrom . '>' . "\r\n" . 
        'X-Priority: 3' . "\r\n" . 
        'X-Mailer: PHP ' . phpversion() .  "\r\n" . 
        'Reply-To: ' . $fromname . ' <' . $emailfrom . '>' . "\r\n" .
        'MIME-Version: 1.0' . "\r\n" . 
        'Content-Transfer-Encoding: 8bit' . "\r\n" . 
        'Content-Type: text/plain; charset=UTF-8' . "\r\n";
    $params = '-f ' . $emailfrom;
    $test = mail($emailto, $subject, $messagebody, $headers, $params);
    // $test should be TRUE if the mail function is called correctly

    header("Location: http://xxx.com");

    die();
?>

Open in new window



The email IS being sent, but the PHP variable $mes that I am attempting to make use of has a problem.


The email when it arrives looks like this:

zero

What I expected was to see the following subject and message body:

subject: 'activity on xxx detected:  content of param passed in
message body: 'There was a page hit on xxx:  content of param passed in

If I remove the $mes PHP variable I am trying to append to the end of the subject and message body (above) -- the subject and message body come through GREAT, minus the custom message(which is the entire point of all this)

zero
0
I am requesting a web service through an xml, I verify the answer with the Fiddler tool and it returns an Http 200, but the answer as such does not return the information that the web service should send me but it returns the wsdl of the same. I do not know if you are making any mistakes in the programming, please help me.
0
Become a Microsoft Certified Solutions Expert
LVL 12
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Our company is moving some components to our internal cloud and I am working in a project and one of the task is to expose an existing legacy java class as soap web service. Can anyone please help me stir in the right direction? How can  I write a soap Producer on existing new class and methods? Should I write a new class and extend this class or should I write a subclass? What is the best  way  to approach  this?I  am new  to integration projects. The company is using  Mule  Esb as an integration solution? Also how Mule esb fitst together  with all this?I am new to  Mule  esb.
0
with the help of experts on this exchange i managed to cobble together this code
it does work almost, but it produces a text file and not an xml document file, or i am not smart enough to load the xml document.
So any help would be appreciated

Sub plireader()
'On Error Resume Next

'CEMgetattendance -  CLETracker
'DEV_getattendance -152413
 

Dim strrequest As String
Dim objhttp As Object
    strXmlToSend = "<company>CLETracker</company>"
    '    strXmlToSend = "<company>CLETracker</company>"

webserviceurl = "https://www.pli.edu/public/CEM/Service.asmx"

 Set objhttp = CreateObject("Msxml2.XMLHTTP.6.0")
MsgBox "send now"
  strrequest = "<?xml version=""1.0"" encoding=""utf-8""?>" _
               & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" _
               & "<soap:Body>" _
               & "<CEMgetAttendence xmlns=""http://www.pli.edu/public/CEM/"">" _
               & "<company>CLETracker</company>" _
               & "</CEMgetAttendence>" _
               & "</soap:Body>" _
               & "</soap:Envelope>"
Dim resp As String

MsgBox strrequest
objhttp.Open "POST", webserviceurl, False
objhttp.setRequestHeader "SOAPAction", "http://www.pli.edu/public/CEM/Service.asmx?op=CEMgetAttendence"

objhttp.setRequestHeader "Content-Type", "text/xml"
objhttp.send (strrequest)
  ' resp = http.HttpGetText(url)
0
I am trying to get XML validation working for a SOAP server but I've run into a couple of issues.

XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://p2p.thalesgroup.com/wsdl/status/xsd"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified"
  attributeFormDefault="qualified"
  targetNamespace="http://p2p.thalesgroup.com/wsdl/status/xsd">
 
  <xsd:element name="Alive">
    <xsd:complexType>
      <xsd:annotation>
        <xsd:documentation>
          - Alive is sent periodically to verify the connection status
        </xsd:documentation>
      </xsd:annotation>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Open in new window


XML:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap-enc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body><Alive/></soap:Body>
</soap:Envelope>

Open in new window


First Issue:
SOAP elements are not being recognized.
Validator Output: Cannot Find The Declaration Of Element 'soap:Envelope'., Line '1', Column '225'.
I found a Stack Overflow thread describing the same issue but the described solutions do not work for me.

Second Issue:
Even if I remove the SOAP elements, I still have a namespace issue.
Validator Output: Cannot Find The Declaration Of Element 'Event'., Line '1', Column '8'.
0
Hello,

I have a webservice that I,m trying to apply a custome security, when I try to call the service it display the following error:


http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:FailedAuthentication

At least one security token in the message could not be validated.


To add the security I modify the service config file:

[b][b]<services> <service name = "WcfService1.Service1"> <endpoint address="" binding="customBinding" bindingConfiguration="customBindingOasis" contract="WcfService1.IService1"> <headers> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:UsernameToken> <wsse:Username>USERNAME</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password> </wsse:UsernameToken> </wsse:Security> </headers> </endpoint> </service> </services> <bindings> <customBinding> <binding name ="customBindingOasis"> <security authenticationMode="UserNameOverTransport" includeTimestamp="false" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"> <secureConversationBootstrap /> </security> <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8"> <readerQuotas maxDepth="32"
0
Hello,

I have this WCF service that works fine using soap1. I'm trying to change it to run in soap1.2 but I have not been able.

I have try changin diferents things in the webconfig.

First I change the basicHttpBinding for wsHttpBinding.  I also change the protocol , remove the soap1.1 and add the soap 1.2

How I can made that my WCF web service run in soap1.2?
0
I am part of a development for a SOAP web services client on WCF/.NET. After a session of sending request, team for server side left feedback "extend someAction from schema i am mentioning below", and mentioned an URL. In this context, what does it mean to extend from schema?
0
Hi,
I'm trying to use a webservice (.net if it matters).
Using the code directly below I get a response.
$options = array(
	'username' => "myusername",
	'password' => "mypassword"

);

$url = "https://service.mydomain.com/soap12";

$client = new SoapClient($url);
$client->__soapCall('login',$options);
$fcs = $client->__getFunctions();
dd($fcs);

Open in new window


I get a return so thinking something is working (shortened below):
array:145 [▼
  0 => "UNKNOWN ActivityChange(UNKNOWN $par)"
  1 => "UNKNOWN Admin(UNKNOWN $par)"
  2 => "UNKNOWN DirectIntefaceTest3(UNKNOWN $par)"
  3 => "UNKNOWN DirectIntefaceTest(UNKNOWN $par)"
  4 => "UNKNOWN LogEntryGet(UNKNOWN $par)"
  5 => "UNKNOWN LogEntryDetails(UNKNOWN $par)"
  6 => "UNKNOWN SystemUploads(UNKNOWN $par)"
  7 => "UNKNOWN TestUpload(UNKNOWN $par)"
  8 => "UNKNOWN AppointmentGet(UNKNOWN $par)"
]

Open in new window


I'm trying to use the AppointmentGet. Trying below:
$params = array(
	'AppointmentSince'  =>'2017-07-11T07:00:00',
	'AppointmentUntil'  =>'2017-07-11T012:00:00',
	'SerialNumber'		=> '9999'
);

$response = $client->__soapCall('AppointmentGet', $params);
also:
$response = $client->AppointmentGet($params);

Open in new window

Regardless same error:

SoapFault in TestController.php line 70: Internal Server Error
(line 70 being the $response line)

The company that provides the service has some documentation:
https://partnerhub.pbsdealers.com/soap12/metadata?op=AppointmentGet

Any ideas?
0
Hi,
we are in need of technical help to achieve secure comms using secure Soap (certificated) to a government web-service.
We have to send and receive encrypted SHA256 xml content as the payload using SSL transport.
Is this an area in which you have expertise?
If so, we are prepared to pay for consulting/help if a working result can be achieved.
If you have expertise here, and are able to offer guidance, then we can send real code and proper full description of our problems.
Thanks,
Justin Graham.
New Zealand (GMT + 12)
0
How do I retrieve the values of the SOAP Fault message to display to the user by using classical asp?
I am sending an xml document and they use SOAP authentication.
I have attached a snapshot of the message, and its a valid error message.
 I just need to retrieve and display the SOAP FAULT values.

After researching, I know I need to extract the child nodes but I can not quite it right.
I know its XML and I should be able to extract the fault string, actor and message I couldn't find what was the best way .
I am thinking in the savdoc I should  try to extract the  child node <faultstring>.
Any help appreciated.
Below is my code for sending/receiving XML etc. It works fine.
    url = "http://ws.mysite.com/test/Gateway.asmx"
    Set objXMLHTTP = server.Createobject("MSXML2.ServerXMLHTTP")
    objXMLHTTP.Open "POST", url, false
    objXMLHTTP.setRequestHeader "Content-Type", "text/xml" 
    objXMLHTTP.send xmlmsg

'get any XMLHTTP MESSAGES
   strResult= objXMLHTTP.ResponseText
   strStatus = objXMLHTTP.StatusText
   savdoc = objXMLHTTP.ResponseText

'get any SOAP FAULT MESSAGES IF THEY EXISTS AND DISPLAY TO USER

Open in new window

SoapFaultMessage.JPG
0
HTML5 and CSS3 Fundamentals
LVL 12
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.


There is also helpful tutorials on BlazeMeter.com for JMeter, you don't have to use BlazeMeter but they do allow you to import your JMeter .jmx file and run tests if that is a route you want to go.

I am reading as above. I wonder what are difference between JMeter Vs BlazeMeter, advantages, disadvantages, practical uses.Please advise
0
If you're using SOAP to send authentication (username and password) and data from one site to another, is the authentication details secure? Can it be intercepted? In particular I'm authenticating and sending the data to SharePoint 2013.
0
Hi,

I am going through below link
https://www.ibm.com/developerworks/library/ws-whichwsdl.
which wsdl binding style to use which time. i wonder which wsdl element wraps all operations?
 Please advise
0
Hi I wonder if you gurus can assist please.

I have a really simply SOAP server in PHP that at present I just need to send back a valid XML string for. All works ok from the request side but my response seems to be altering the < & > to &lt; / &gt;

Here is my basic SOAP Server:
<?php 

require "functions/getProperties.function.php";

$options = array(
	'uri' => 'http://s3052/webServices/ShepwayWebService',
    'location' => 'http://s3052/webServices/ShepwayWebService.php',
    'trace' => true
);

$server = new SOAPServer(null, $options);

$server->addFunction("GetProperties");

$server->handle();

?>

Open in new window


Any my functions file:
<?php

function GetProperties($strSearch){	

	// required classes
	require_once("config.php");	
	
	$response = '<GetPropertiesResponse xmlns="http://www.mvm.co.uk/webservices/M3PP"><GetPropertiesResult><MVM xmlns="http://www.mvm.co.uk"><mvm:PUBLICPROTECTION xmlns:mvm="http://www.mvm.co.uk"><M3PPPROPERTIES xmlns="http://www.mvm.co.uk"><SUBUPRN>50028034</SUBUPRN><UKEY>PI/000025895</UKEY><ADDRESS>1 Trimworth Road, Folkestone, Kent, CT19 4EJ</ADDRESS><SEARCH>TRIMWORTH ROAD</SEARCH><BUILDING_NUMBER>1</BUILDING_NUMBER><CLOSED>N</CLOSED><OUT_OF_AREA>N</OUT_OF_AREA></M3PPPROPERTIES></mvm:PUBLICPROTECTION><RESULTS><RESULT><RESULTCODE>0</RESULTCODE><RESULTDESC>Successful</RESULTDESC></RESULT></RESULTS></MVM></GetPropertiesResult></GetPropertiesResponse>';
		
	return $response;

}

?>

Open in new window


Now, If I run a test using the following code and look at the source code it works fine:
<?php 

$pf_payload  = '<GetProperties><strSearch>Trimworth Road</strSearch><strBuilding_Number/></GetProperties>';

// make the SOAP call
$options = array(    
	'uri' => 'http://s3052/webServices/ShepwayWebService',
    'location' => 'http://s3052/webServices/ShepwayWebService.php',
	'trace' => 1
);

$stub = new SoapClient(null,$options);

try { 
	echo $stub->GetProperties($pf_payload);
} catch (SoapFault $exception) { 
	error_log("\n## SOAP call exception \n: " . $exception);       
} 

error_log("\n## request : \n" . htmlspecialchars_decode($stub->__getLastRequest()));
error_log("\n## response : \n" . htmlspecialchars_decode($stub->__getLastResponse()));

?>

Open in new window


This reply "SEEMS" correct:

Open in new window

0
We have created a stored procedure and it is sitting on the db server.  We have tested the server locally and against the server directly using the same data as we are sending in the API and the data loads correctly.  When we use the API nothing is being loaded.  Our parameter in the SP is a XML parameter.  We are not getting any errors returned.  We have try and catches, begins and ends in the SP and it's getting to the return without issue.  But like I said nothing is being loaded.  Are we missing something?
singlerow.txt
0
Does anyone know how to gather the SOAP call and response for a specific website, using an API?
0

SOAP Protocol

270

Solutions

402

Contributors

Simple Object Access Protocol (SOAP) is a protocol specification for exchanging structured information in the implementation of web services. It uses the XML Information Set for its message format and uses other protocols, notably Hypertext Transfer Protocol (HTTP) and the Simple Mail Transfer Protocol (SMTP) for message transmission.

Top Experts In
SOAP Protocol
<
Monthly
>