Consuming Webservice with SSL certificate in NetBeans: How to configure Truststore and KeyStrore

StackOverflow https://stackoverflow.com/questions/13288427

  •  27-11-2021
  •  | 
  •  

سؤال

I have generated the client Binding using NetBeans

NetBeans -> New -> Java Project

Right Click -> Webservice Client Here I gave my wsdl url and generated the client bindings.

I want to configure KeyStore, TrustStore.

I have client.cer and server.cer files with me.

If through Code also cert can be signed please share the process.

هل كانت مفيدة؟

المحلول

In your NetBeans Project

  1. Right Click on

    Project Root --> Web Service References --> service and Click on "Edit Webservice Attributes"

  2. A popup window will appear with service tag Please configure Keystore and Trustsotre in this window by clicking on respective buttons.

Once the configuration is done *\build\classes\META-INF\service.svc.wsdl_wsdl0.xml* file will be updated with keystore and trustore entry.

<wsp1:Policy wsu:Id="WS2007HttpBinding_IWebServicePolicy">
    <wsp1:ExactlyOne>
        <wsp1:All>
            <wsam:Addressing wsp1:Optional="false"/>
            <sc:KeyStore wspp:visibility="private" type="JKS" storepass="changeit" alias="client2" keypass="changeit" location="client.jks"/>
            <sc:TrustStore wspp:visibility="private" type="JKS" storepass="changeit" peeralias="chageit" location="server.jks"/>
        </wsp1:All>
    </wsp1:ExactlyOne>
</wsp1:Policy>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top