Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8082783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:14:02+00:00 2026-06-05T17:14:02+00:00

I’m implementing WS-based Agent which will manage soap requests to/responses from PCRF . The

  • 0

I’m implementing WS-based Agent which will manage soap requests to/responses from PCRF. The connection is through https port and it is using Java Key Store (a key-store tool) to generate a key-store file from a trusted certificate. The connection seems to be OK (I’m not sure if the authentication is successful or not), but returned info (the response) is a short unreadable string.

The same procedure through SoapUI app is working just fine.

The only difference between both procedures is that by the 1st I’m using a key-store and by the 2nd I’m using the trusted certificate.

How can I possibly solve that? I do not understand where something goes wrong.

If it would help I can share Java source used for SOAP messages sender and the responses received from PSRF, into SoapUI and into implemented WS.

package SOAPSender;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;

public class DebugMain {

    public static void main(String[] args) {
        //PCRFProvisioningAgent temp = new PCRFProvisioningAgent(); 

            loadKeyAndTrustStore();

            StringBuffer outputStream = new StringBuffer();
            BufferedWriter wr = null;
            BufferedReader rd = null;
            Socket sock = null;
            String outputBuffer = null;

            try {

                // Create socket
                sock = new Socket("10.96.227.219", 8080);

                // Create header
                wr = new BufferedWriter(new OutputStreamWriter(
                        sock.getOutputStream(), "UTF-8"));

                String xmlData = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:rm=\"rm:soap\">"+
                           "<soapenv:Header/>"+
                           "<soapenv:Body>"+
                              "<rm:getSubscriber>"+
                                 "<inPara>"+
                                    "<subscriber>"+
                                       "<attribute>"+
                                          "<key>USRIDENTIFIER</key>"+
                                          "<value>284090000000004</value>"+
                                       "</attribute>"+
                                    "</subscriber>"+
                                 "</inPara>"+
                              "</rm:getSubscriber>"+
                           "</soapenv:Body>"+
                        "</soapenv:Envelope>";              

                wr.write("POST https://10.96.227.219:8080/axis/services/ScfPccSoapServiceEndpointPort HTTP/1.1\r\n");
                wr.write("User-Agent: https://10.96.227.219:8080/axis/services/ScfPccSoapServiceEndpointPort\r\n");
                wr.write("Content-Length: " + xmlData.length() + "\r\n");
                wr.write("Content-Type: text/xml;charset=UTF-8\r\n");
//              wr.write("SOAPAction: \"rm:soap/ScfPccSoapServiceEndpoint/getSubscriberRequest\"\r\n");
                wr.write("SOAPAction: \"\"\r\n");
                wr.write("\r\n");

                // Send data
                wr.write(xmlData);
                wr.flush();

                // Read response
                // exception handler - when connection is reset instead of close
                // after sending a packet from source
                char cbuf[] = new char[4096];
                int i = 0;
                // buffer is sized to max 4096 packet size

                try {
                    rd = new BufferedReader(new InputStreamReader(
                            sock.getInputStream(), "UTF-8"));
                    while ((i = rd.read(cbuf)) != -1) {
                        outputStream.append(cbuf, 0, i);
                        int contStartIndex = outputStream.toString().indexOf(
                                "Content-Length: ")
                                + "Content-Length: ".length();
                        int contEndIndex = outputStream.toString().indexOf("\n",
                                contStartIndex) - 1;
                        if (outputStream.toString().indexOf("Content-Length: ") != -1) {
                            int contLength = Integer.valueOf(
                                    outputStream.toString().substring(
                                            contStartIndex, contEndIndex))
                                    .intValue();
                            int headerLength = outputStream
                                    .toString()
                                    .substring(
                                            0,
                                            outputStream.toString().indexOf(
                                                    "\n\r\n")).length() + 3;
                            // if the message body is complete but there is not an
                            // ending character
                            // while will break
                            // warning - with national characters! content length is
                            // count of bytes not chars
                            if (i - headerLength >= contLength)
                                break;
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                System.out.println("--------\n" + String.valueOf(cbuf)
                        + "\n--------------");
                outputBuffer = outputStream.toString();

            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                try {
                    if (wr != null)
                        wr.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                try {
                    if (rd != null)
                        rd.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                try {
                    if (sock != null)
                        sock.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
    }

    private static void loadKeyAndTrustStore() {
        try {
            // System.out.println(Constants.ROOT_PATH + Constants.STORE_FILE);
            // AdminLogger.error("Certificate file: " + Constants.ROOT_PATH
            // + Constants.STORE_FILE);

            // System load ssl the file of certificate
            // Load Key store

            System.out.println(System.getProperty("javax.net.ssl.keyStoreType"));
            System.setProperty("javax.net.ssl.keyStoreType", "****");
            System.out.println(System.getProperty("javax.net.ssl.keyStoreType"));

            System.out.println(System.getProperty("javax.net.ssl.keyStore"));
            System.setProperty("javax.net.ssl.keyStore",
                    "****");
            System.out.println(System.getProperty("javax.net.ssl.keyStore"));

            System.out.println(System.getProperty("javax.net.ssl.keyStorePassword"));
            System.setProperty("javax.net.ssl.keyStorePassword", "****");
            System.out.println(System.getProperty("javax.net.ssl.keyStorePassword"));


            // TrustStore

            System.out.println(System.getProperty("javax.net.ssl.trustStore"));
            System.setProperty("javax.net.ssl.trustStore",
                    "****");
            System.out.println(System.getProperty("javax.net.ssl.trustStore"));

            System.out.println(System.getProperty("javax.net.ssl.trustStorePassword"));
            System.setProperty("javax.net.ssl.trustStorePassword", "****");
            System.out.println(System.getProperty("javax.net.ssl.trustStorePassword"));

        } catch (Exception ex) {
            // AdminLogger.error(ex, "StartupServlet.loadKeyAndTrustStore");
        }
    }

}

This is the response:

…and here is the response from SoapUI app:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <getSubscriberResponse xmlns="rm:soap">
         <result xmlns="">
            <resultCode>12302</resultCode>
            <paras>
               <key>errorDescription</key>
               <value>The subscriber does not exist.</value>
            </paras>
         </result>
      </getSubscriberResponse>
   </soapenv:Body>
</soapenv:Envelope>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:14:04+00:00Added an answer on June 5, 2026 at 5:14 pm

    Sockets is not the ideal way to invoke web services from Java. Please use a Java API like JAX-WS. Obtain the WSDL from the PSRF web service and generate the client stubs using ws-import command.

    On security, you will need to use JAX-WS security API to invoke a Web service secured with WS-Security.

    See this thread – jax-ws-consuming-web-service-with-ws-security-and-ws-addressing

    Thanks,
    Sreehari.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.