cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to setParts when using groovy to add an outgoingWss with SignatureEntry?

Highlighted
Senior Member

Failed to setParts when using groovy to add an outgoingWss with SignatureEntry?

I am tring to add an outgoingWss item for authentication with certificate. The groovy code is listed below. The outgoingWss entry is created as expected except parts missed.  'Timestamp' and 'Body'  are expected in Parts.  Any idea or suggestion?

if (!WssC.getOutgoingWssByName("mycert")) {
     def owss_cert = WssC.addOutgoingWss("mycert");
     TimestampEntry timeEntry=(TimestampEntry) owss_cert.addEntry("Timestamp");
     timeEntry.setTimeToLive("500");
    timeEntry.setStrictTimestamp(true); 
    SignatureEntry signature = (SignatureEntry) owss_cert.addEntry("Signature")
    signature.setCrypto("myKeystore.jks");
    signature.setUsername("mycert");
    signature.setPassword("passwords");
    signature.setKeyIdentifierType(1);
    signature.setUseSingleCert(true);   
    List<StringToStringMap> parts = new ArrayList<StringToStringMap>();
    StringToStringMap ts = new StringToStringMap();
    ts.put("ID", "");
    ts.put("Name", "Timestamp");
    ts.put("Namespace", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
    ts.put("Encode", "Content");
    parts.add(ts);
    StringToStringMap body = new StringToStringMap();
    body.put("ID", "");
    body.put("Name", "Body");
    body.put("Namespace", "http://schemas.xmlsoap.org/soap/envelope");
    body.put("Encode", "Content");
    parts.add(body);
    signature.setParts(parts);
    signature.saveConfig(); 
}

soapUI01.PNG

2 REPLIES 2
Community Hero

Re: Failed to setParts when using groovy to add an outgoingWss with SignatureEntry?

Where does the above script lying? how it gets executed?

If you are using for sending SOAP request, than can't SOAP Request step be used which automatically being taken care by the tool?


Regards,
Rao.
Community Manager

Re: Failed to setParts when using groovy to add an outgoingWss with SignatureEntry?

Hi @guoff,

 

Was the answer to your question found? Please share your solution with us.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓


Participate in the API Testing vs. UI Testing online community event to win great prizes!
New Here?
Join us and watch the welcome video:
Join the Online Event to Win
Top Kudoed Authors