Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Here's my code for using the FedEx v6 tracking web services. Not pretty, but it works. Any comments and improvements welcome!

Fedex Track ( accountKey ; accountNumber ; accountPassword ; meterNumber ; trackingNumber )

// Send data

targetURL = "https://ws.fedex.com:443/web-services/ship";
targetNamespace = "http://fedex.com/ws/track/v6";

URL url = new URL( targetURL );
HttpURLConnection conn = url.openConnection();
//if( soapaction != null ) conn.setRequestProperty( "SOAPAction", soapaction );
conn.setRequestProperty( "content-type", "text/xml" );
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());

soapRequest = "<SOAP-ENV:Envelope";
soapRequest += " xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"";
soapRequest += " xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"";
soapRequest += " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"";
soapRequest += " xmlns:xsd="http://www.w3.org/2001/XMLSchema"";
soapRequest += " xmlns="" + targetNamespace + "">";
soapRequest += "<SOAP-ENV:Body>";
soapRequest += "<TrackRequest>";
soapRequest += "<WebAuthenticationDetail>";
soapRequest += "<UserCredential>";
soapRequest += "<Key>" + accountKey + "</Key>";
soapRequest += "<Password>" + accountPassword + "</Password>";
soapRequest += "</UserCredential>";
soapRequest += "</WebAuthenticationDetail>";
soapRequest += "<ClientDetail>";
soapRequest += "<AccountNumber>" + accountNumber + "</AccountNumber>";
soapRequest += "<MeterNumber>" + meterNumber + "</MeterNumber>";
soapRequest += "</ClientDetail>";
soapRequest += "<Version>";
soapRequest += "<ServiceId>trck</ServiceId>";
soapRequest += "<Major>6</Major>";
soapRequest += "<Intermediate>0</Intermediate>";
soapRequest += "<Minor>0</Minor>";
soapRequest += "</Version>";
soapRequest += "<PackageIdentifier>";
soapRequest += "<Value>" + trackingNumber + "</Value>";
soapRequest += "<Type>TRACKING_NUMBER_OR_DOORTAG</Type>";
soapRequest += "</PackageIdentifier>";
soapRequest += "</TrackRequest>";
soapRequest += "</SOAP-ENV:Body>";
soapRequest += "</SOAP-ENV:Envelope>";

wr.write(soapRequest);
wr.close();

// Get the response
String response;
InputStream responseStream;
try {
	responseStream = conn.getInputStream();
	success = 1;
} catch( IOException e ) {
	success = 0;
	if( conn.getResponseCode() == 500 ) {
		responseStream = conn.getErrorStream();
	} else throw e;
}
response = responseStream.getText("utf-8");
responseStream.close();

replaceText = " xmlns="" + targetNamespace + """;

response=response.replace(replaceText,'');

return response;
  • 2 weeks later...

use markupbuilder to create the XML - makes it easier to troubleshoot

 

investigate wslite as the soap wrapper.

the result  comes back in a XMLslurper ready to use.

 

Why are you declaring the namespaces when they are not being used??

import groovy.xml.MarkupBuilder

writer = new StringWriter()
xml = new MarkupBuilder(writer)
xml.getMkp().xmlDeclaration(version:'1.0', encoding: 'UTF-8')
xml.'SOAP-ENV:Envelope'('xmlns:SOAP-ENV': 'http://schemas.xmlsoap.org/soap/envelope/', 'xmlns:SOAP-ENC': 'http://schemas.xmlsoap.org/soap/encoding/', 'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema' , 'xmlns':targetNamespace ){
'SOAP-ENV:Body'{
	TrackRequest{
		WebAuthenticationDetail{
			UserCredential{
				Key(accountKey)
				Password(accountPassword)
			}
		}
		ClientDetail{
			AccountNumber(accountNumber)
			MeterNumber(meterNumber)
		}
		Version{
			ServiceId('trck')
			Major(6)
			Intermediate(0)
			Minor(0)
		}
		PackageIdentifier{
			Value(trackingNumber)
			Type('TRACKING_NUMBER_OR_DOORTAG')
			}
		}
	}
}
soapRequest = writer.toString().trim()
  • 5 months later...

Hello,

I'm also trying to make SOAP sending with scriptmaster and it's difficult for me.

I tried SOAPUI and got a good result with a normal XML structure but I don't know how to implement in scriptmaster.

can you help me please ?

Kind regards.

Antoine

 

 

my normal SOAPUI xml which is working is this one :

 

 

  <soapenv:Header>
   <soapenv:Body>
      <vet:vetTapswSearchProduct>
         <vet:searchCriteria>amoxi</vet:searchCriteria>
      </vet:vetTapswSearchProduct>
   </soapenv:Body>
</soapenv:Envelope>
 

 

I've tried to copy your solution John but  :

with your solution  I have this error :

 

groovy.lang.MissingPropertyException: No such property: targetNamespace for class: Script1

 

 

with this in script master I have an error

 

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

Script1.groovy: 1: unexpected token: XML @ line 1, column 6.

  

 

 

Post XML Data ( soapaction ; accountusername ; accountpassword )

 

// Send data

 

targetURL = "https://test.vetpoint.ch/webtools/control/SOAPService";

 

URL url = new URL( targetURL );

HttpURLConnection conn = url.openConnection();

//if( soapaction != null ) conn.setRequestProperty( "SOAPAction", soapaction );

conn.setRequestProperty( "content-type", "text/xml" );

conn.setDoOutput(true);

OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());

 

soapRequest = "<SOAP-ENV:Envelope";

soapRequest += " xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"";

soapRequest += " xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"";

soapRequest += " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"";

soapRequest += " xmlns:xsd="http://www.w3.org/2001/XMLSchema"";

soapRequest += "<WebAuthenticationDetail>";

soapRequest += "<UserCredential>";

soapRequest += "<Key>" + accountusername + "</Key>";

soapRequest += "<Password>" + accountpassword + "</Password>";

soapRequest += "</UserCredential>";

soapRequest += "</WebAuthenticationDetail>";

soapRequest += "<SOAP-ENV:Body>";

soapRequest += "<vet:vetTapswSearchProduct>";

soapRequest += "<vet:searchCriteria>amoxi</vet:searchCriteria>";

soapRequest += "</vet:vetTapswSearchProduct>";

soapRequest += "</SOAP-ENV:Body>";

soapRequest += "</SOAP-ENV:Envelope>";

 

wr.write(soapRequest);

wr.close();

 

// Get the response

String response;

InputStream responseStream;

try {

responseStream = conn.getInputStream();

success = 1;

} catch( IOException e ) {

success = 0;

if( conn.getResponseCode() == 500 ) {

responseStream = conn.getErrorStream();

} else throw e;

}

response = responseStream.getText("utf-8");

responseStream.close();

 

replaceText = " xmlns="" + targetNamespace + """;

 

response=response.replace(replaceText,'');

 

return response;

 

 

with this in script master I have an error : groovy.lang.MissingPropertyException: No such property: targetNamespace for class: Script1 

 

 

 

// Send data

 

targetURL = "https://test.vetpoint.ch/webtools/control/SOAPService";

 

URL url = new URL( targetURL );

HttpURLConnection conn = url.openConnection();

//if( soapaction != null ) conn.setRequestProperty( "SOAPAction", soapaction );

conn.setRequestProperty( "content-type", "text/xml" );

conn.setDoOutput(true);

OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());

 

soapRequest = "<SOAP-ENV:Envelope";

soapRequest += " xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"";

soapRequest += " xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"";

soapRequest += " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"";

soapRequest += " xmlns:xsd="http://www.w3.org/2001/XMLSchema"";

soapRequest += "<WebAuthenticationDetail>";

soapRequest += "<UserCredential>";

soapRequest += "<Key>" + accountusername + "</Key>";

soapRequest += "<Password>" + accountpassword + "</Password>";

soapRequest += "</UserCredential>";

soapRequest += "</WebAuthenticationDetail>";

soapRequest += "<SOAP-ENV:Body>";

soapRequest += "<vet:vetTapswSearchProduct>";

soapRequest += "<vet:searchCriteria>amoxi</vet:searchCriteria>";

soapRequest += "</vet:vetTapswSearchProduct>";

soapRequest += "</SOAP-ENV:Body>";

soapRequest += "</SOAP-ENV:Envelope>";

 

wr.write(soapRequest);

wr.close();

 

// Get the response

String response;

InputStream responseStream;

try {

responseStream = conn.getInputStream();

success = 1;

} catch( IOException e ) {

success = 0;

if( conn.getResponseCode() == 500 ) {

responseStream = conn.getErrorStream();

} else throw e;

}

response = responseStream.getText("utf-8");

responseStream.close();

 

replaceText = " xmlns="" + targetNamespace + """;

 

response=response.replace(replaceText,'');

 

return response;

 

 

 

 

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.