Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4052 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Hello,

I'm new on this forum and I like some more information about PostDatatoUrl.

I like to use this function to check a VAT number on a site.

It's not totally clear for me which the exact contents has to be for the parameters key, value, url

For now I got something like this :

PostDataToURL( ? ; Company::TVA_Number ;"http://ec.europa.eu/...VatService.wsdl?" )

The field TVA_Number from the table Company got something like this BE0123456789.

Which is the parameter for 'key' and are the values for 'value' and 'url' correct ?

Thanx for helping me.

Donamd

Posted

I'm not sure exactly what you need to do but the Post Data To URL function is for executing an HTTP POST. The way the module is written it takes a single key/value pair as parameters that get passed in the POST.

Posted

The web address you give is pointing to a wsdl, so you need to go off and research getting fIlemaker to talk to WebServices

I have just got it to return my VAT registration so the service is working...

360Works do a plug in for this (not cheap) and there is another well known one for free..

Posted

I would suggest first downloading soapUI, creating a new project, entering the WSDL address in, and then navigating to the request and double-clicking it. Then enter your country code in the left window and your vatNumber where it reads '?'. You should see the server response on the right upon clicking play button. This is a very convenient way to test your calls and the server.

With SOAPUI, you can also simply copy and paste the request envelope into a 360 Works ScriptMaster script to send the raw POST.

Below script assumes you have set soap_message input variable =

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ec.europa.eu:taxud:vies:services:checkVat:types">

<soapenv:Header/>

<soapenv:Body>

<urn:checkVat>

<urn:countryCode>AT</urn:countryCode>

<urn:vatNumber>U63518107</urn:vatNumber>

</urn:checkVat>

</soapenv:Body>

</soapenv:Envelope>

as copied from SoapUI and soap_action variable to space

and soap_url variable to http://ec.europa.eu/...checkVatService

(all of this copied from 'raw' tab of soapUI)

Then you just run the script below, derived from a sample java snippet from the web but adapted slightly for FM:

import java.io.*;

import java.net.*;

/** A simple web service client in Java.

The web service is invoked via SOAP and HTTP and returns result to Filemaker.

*/

try {

URL url= new URL(soap_url);

// open an HTTP connection to the web service

HttpURLConnection connection = (HttpURLConnection)url.openConnection();

connection.setRequestMethod("POST");

connection.setDoOutput(true);

connection.setDoInput(true);

// make it a SOAP request

connection.setRequestProperty("Content-type", "text/xml; charset=utf-8");

connection.setRequestProperty("SOAPAction", soap_action);

String msg = soap_message;

// send the SOAP request

byte[] bytes = msg.getBytes();

connection.setRequestProperty("Content-length", String.valueOf(bytes.length));

OutputStream out = connection.getOutputStream();

out.write(bytes);

out.close();

// read and print the SOAP response

InputStreamReader isr =

new InputStreamReader(connection.getInputStream());

BufferedReader inp = new BufferedReader(isr);

String inputLine;

String AllLines='';

while ((inputLine = inp.readLine()) != null)

AllLines = AllLines + inputLine + 'n';

AllLines = AllLines.replaceAll('&lt;','<');

AllLines = AllLines.replaceAll('&gt;','>');

inp.close();

return AllLines;

} catch (Exception e) {

System.out.println("-- error:" + e.getMessage());

}

SOAPUI can also create java classes if you install Axis.

Alternately you can use the free Beezwax plugin for SOAP requests. SOAPUI and similar tools may still prove useful either way.

  • 1 month later...
Posted

I just discovered wslite, which is a Groovy webservices class

Two little functions using it.

Currency converter


// currencyConvert( cFrom ; cTo )

// 12_03_19  JR

// v1.0

// adapted from wslite examples

// need wslite.jar from https://github.com/jwagenleitner/groovy-wslite/downloads

import wslite.soap.SOAPCLient

proxy = new SOAPClient("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL")

rate = proxy.send(SOAPAction:'http://www.webserviceX.NET/ConversionRate'){

body {

  ConversionRate('xmlns':'http://www.webserviceX.NET/') {

   FromCurrency(cFrom)

   ToCurrency(cTo)

  }

}

}

return rate.ConversionRateResponse





VAT checker



// VATcheck( countryCode ; VATnumber )

// 12_03_19 JR

// v1.0

// checks VAT registration information from EU website

// need wslite.jar from https://github.com/jwagenleitner/groovy-wslite/downloads

import wslite.soap.SOAPClient

proxy = new SOAPClient("http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl")

isValid = proxy.send(SOAPAction:'http://ec.europa.eu/taxation_customs/vies/services/checkVatService'){

body('xmlns':'urn:ec.europa.eu:taxud:vies:services:checkVat:types'){

checkVat{

countryCode(countryCode)

vatNumber(VATnumber)

}

}

}

//choices

//return rate.checkVatResponse

return isValid.checkVatResponse.valid

return isValid.checkVatResponse.name

return isValid.checkVatResponse.address



  • 3 months later...
Posted

My latest favorite is HTTPBuilder. It's very groovy like and I'm personally using it via REST. Although going with SOAP is just a matter of parsing with XmlSlurper - which rocks by the way.

http://groovy.codehaus.org/modules/http-builder/doc/index.html

  • 1 year later...
Posted

Hello,

 

I've tried to send a xml soap message with SOAPUI and I've succeded and got a valid result.

it's my xml file 

 

 

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

 but when I try to implement in scriptmaster I don't know how to do it.

So I've copied your code but I've got no result and no error code. of course I've put the parameter soap_url , soap_message and soap_action

Can you help me ? I try now for weeks to send these XML with filemaker but I'm really confuse and can't not find a scriptmaster code I can use.

kind regards.

Antoine

 

 

 

import java.io.*;

import java.net.*;

/** A simple web service client in Java.

The web service is invoked via SOAP and HTTP and returns result to Filemaker.

*/

try {

URL url= new URL(soap_url);

// open an HTTP connection to the web service

HttpURLConnection connection = (HttpURLConnection)url.openConnection();

connection.setRequestMethod("POST");

connection.setDoOutput(true);

connection.setDoInput(true);

// make it a SOAP request

connection.setRequestProperty("Content-type", "text/xml; charset=utf-8");

connection.setRequestProperty("SOAPAction", soap_action);

String msg = soap_message;

// send the SOAP request

byte[] bytes = msg.getBytes();

connection.setRequestProperty("Content-length", String.valueOf(bytes.length));

OutputStream out = connection.getOutputStream();

out.write(bytes);

out.close();

// read and print the SOAP response

 

InputStreamReader isr =

new InputStreamReader(connection.getInputStream());

BufferedReader inp = new BufferedReader(isr);

 

String inputLine;

String AllLines='';

while ((inputLine = inp.readLine()) != null)

AllLines = AllLines + inputLine + 'n';

AllLines = AllLines.replaceAll('&lt;','<');

AllLines = AllLines.replaceAll('&gt;','>');

inp.close();

return AllLines;

 

} catch (Exception e) {

System.out.println("-- error:" + e.getMessage());

}

This topic is 4052 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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