This message was deleted.
# general
s
This message was deleted.
l
Hi • First download the latest standalone jar from the bottom of this page - https://wiremock.org/docs/download-and-installation/ • You can test this standalone jar as detailed on this page -
java -jar wiremock-standalone-3.0.4.jar
• Then you need to download the webhooks extension from this page - https://wiremock.org/docs/webhooks-and-callbacks/ Make sure both jars are in the same directory. • You then need to add both the wiremock jar and the extension to the classpath, start wiremock passing in the webhooks extension as a parameter. This is also detailed on the above page: Mac OS/Linux:
Copy code
java -cp wiremock-standalone-3.0.4.jar:wiremock-webhooks-extension-3.0.4.jar \
  wiremock.Run --extensions org.wiremock.webhooks.Webhooks
Windows:
Copy code
java -cp wiremock-standalone-3.0.4.jar;wiremock-webhooks-extension-3.0.4.jar \
  wiremock.Run --extensions org.wiremock.webhooks.Webhooks
r
Thank you @Lee Turner I tried doing that but I get the below: Error: Could not find or load main class wiremock.Run Caused by: java.lang.ClassNotFoundException: wiremock.Run
l
Ah, interesting, What happens when you try
java -jar wiremock-standalone-3.0.4.jar
?
b
FWIW I found success last week in just building a fat jar using
shadowJar
plugin.
Copy code
plugins {
    id 'com.github.johnrengelman.shadow' version '8.1.0'
}
...
dependencies {
    implementation group: 'org.wiremock', name: 'wiremock', version: '3.0.4'
}
...
jar {
    manifest {
        attributes 'Main-Class': 'wiremock.Run'
    }
}
...
assemble.dependsOn 'shadowJar'

shadowJar {
    archiveBaseName.set('my-wiremock-extensions')
    archiveClassifier.set('')
}
Then when you build, it’ll create a fat jar with both standalone and your extensions and they can be invoked doing simply
Copy code
java -jar my-wiremock-extensions-1.0-SNAPSHOT.jar --bind-address 127.0.0.1 --extensions com.example.MyExtensions --verbose --disable-banner &
I like this because you just need 1 jar and it’s a bit simpler to understand for outsiders
r
message has been deleted
@Lee Turner I realised that I was putting in wrong version number of standalone. As I corrected it, I am getting the following:
l
OK, cool. What version of standalone are you using ? Also, do you have the correct version of the webhooks extension ?
r
I'm using version 3.0.1 for standalone and 3.0.4 for webhooks
l
Not sure if it makes a difference but could you upgrade to
3.0.4
of standalone ?
I think the
ProhibitedNetworkAddressException
was introduced recently
And it is used by the most recent webhooks extension
r
Thank you @Lee Turner I updated the version to 3.0.4 Its working.. Thanks for your time 🙌
Thank you @Brandon Trautmann for the time and efforts🙌
l
Excellent.
r
I also had one more doubt. Can I make a POST call to an API, from the Wiremock using PostServeActions?
l
Yes. There is an example of a post on this page here - https://wiremock.org/docs/webhooks-and-callbacks/
r
Thank you @Lee Turner
👍 1