Showing posts with label Soap. Show all posts
Showing posts with label Soap. Show all posts

Thursday, September 1, 2011

Soap asmx logger

There are a lot of resources on the internet about logging soap messages. The problem is they are all incomplete or don't function well. I've used the logger below in my own .asmx (.NET4) webservice running on IIS7. Add the following code to your web.config to enable the logging. (It is by default logging to c:\, so change it as you like in the code-file).
<system.web>
    <webServices>
      <soapExtensionTypes>
        <add type="WebServicesTraceExtension"
             priority="1"
             group="High" />
      </soapExtensionTypes>
    </webServices>
  </system.web>
Download the file here: WebServicesTraceExtension.cs

Tuesday, July 12, 2011

Add dynamic datetime to SoapUI

Sometimes you want to add a simple dynamic datetime to soapUI (the best SOAP tester in the world!). You can do that easily by using the String.format command. Below is an example which returns the time in the following format: 2011-07-12T09:06:11+01:00

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:smar="">
   <soapenv:Body>
      <smar:DateTest>
         <smar:request>
            <smar:Date><![CDATA[${=String.format('%tFT%<tT', new Date() + 10)}+01:00]]></smar:TransactionDate>
         </smar:request>
      </smar:DateTest>
   </soapenv:Body>
</soapenv:Envelope>

Now SOAP testing becomes even more fun!