Make response part of body instead of header in SOAP response
I have requirements where I have to add response details in Body tag instead of Header. For now details are added in Header tag of soap response.
@XmlType
public class CheckBalanceResponse {
private String checkBalanceResult;
@XmlElement(name="CheckBalanceResult")
public String getCheckBalanceResult() {
return checkBalanceResult;
}
public void setCheckBalanceResult(String checkBalanceResult) {
this.checkBalanceResult = checkBalanceResult;
}
}
Generated response is below:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<CheckBalanceResponse xmlns="http://charginggw.org/">
<CheckBalanceResult>Incorrect PIN</CheckBalanceResult>
</CheckBalanceResponse>
</soap:Header>
<soap:Body/>
</soap:Envelope>
I want CheckBalanceResponse tag to be in Body instead of Header. Please suggest what should be done?
do you know?
how many words do you know
See also questions close to this topic
-
Read each name in Array list to create seperate object for
I have a file that has student names, age, and an id number. I have a student class that holds the everything above for each student object. I stored all the names, id numbers. and age separately in an array list. Now im trying to assign the info to create a student object.
public class Student { private String lName; private int idNumber; private int age; public Student() { lName = ""; idNumber = 0; age = 0; } public Student(String l, int i, int a) { lName = l; idNumber = i; age = a; } public void setName(String last) { lName = last; } public String getName() { return lName; } public void setIdNum(int num) { idNumber = num; } public int getIdNum() { return idNumber; } public void setAge(int a) { age = a; } public int getAge() { return age; } }
My Text File looks something like this: This info is stored in parallel array lists. I don't quite get how to implement this into an object to pass it into my second contractor method.
Josh 2134 19 Smith 5256 21 Rogers 9248 19 Andrew 7742 20
Here's what I've tried;
public static void main(String[] args) { String file = "studentData.txt"; Scanner reader = new Scanner(file); ArrayList<String> lastNames = lNames(file); ArrayList<Integer> idNumbers = idNum(file); ArrayList<Integer> ageList = ages(file); Scanner input = new Scanner(System.in); Student s1 = new Student(); // confused about how to implement this constructor with the textile info for (int i = 0; i<idNumbers.size(); i++) { Student user = new Student(lastNames.get(i), idNumbers.get(i), ageList.get(i)); } //user enters idNumber to display age System.out.println("Enter ID Number"); //exception handling to be added int idNum = input.nextInt(); for (int i = 0; i<idNumbers.size(); i++) { if (idNum == idNumbers.get(i)) { s1.setAge(ageList.get(i)); System.out.println(s1.getAge()); } } }
-
Using EdittextPreference for Goto search
sorry for my poor English. I want to use EditTextPreference in my bottom nav like the pic below, ![screenshot][1]
I have recycleview xml in my project with in many sub cardview layouts(which is scrollable) and I want to create item in the bottom nav which is called "Goto". When the "Goto" item is clicked i want it to pop-up like the screenshot. And when user enters a number(according to the cardviews i.e if the number of cardview is 40 user must enter 1-40) I want to search the cardview by its ID. Thank you and I hope u got it, If u have any questions let me know [1]: https://i.stack.imgur.com/grK8P.jpg
My xml format look like this. As you see in the blow since the cardviews are huge in number it is not cool to scroll all the way down that is why i need Goto item in the bottom nav to search it by its ID when the user click number in the EditTextPreference as u see in the screenshot. i.e The screenshot is not from my app
<LinearLayout> <LinearLayout> <androidx.cardview.widget.CardView> <RealtiveLayout> <Textview/> <RealtiveLayout> </androidx.cardview.widget.CardView> </LinearLayout> <LinearLayout> <androidx.cardview.widget.CardView> <RealtiveLayout> <Textview/> <RealtiveLayout> </androidx.cardview.widget.CardView> </LinearLayout> <LinearLayout> <androidx.cardview.widget.CardView> <RealtiveLayout> <Textview/> <RealtiveLayout> </androidx.cardview.widget.CardView> </LinearLayout> <LinearLayout> <androidx.cardview.widget.CardView> <RealtiveLayout> <Textview/> <RealtiveLayout> </androidx.cardview.widget.CardView> </LinearLayout> .. .. .. .. many more..
-
How to get remaining time of the day in java?
I would like to calculate the time remaining for next day 00:00:00 from the current date time.
For e.g. time difference between 2
022-05-07T05:49:41.883807900Z
and2022-05-08T00:00:00Z
Expected answer:
18:10:19
or 65419 (in seconds).How can I achieve this with efficiently using java 8?
-
Hibernate handles id assigning instead of database
I have an auto-increment PK in a table and I want hibernate to handle id assigning instead of database. As my understanding the
@GeneratedValue(strategy = GenerationType.IDENTITY)
lets the database generate a new value with each insertion operation. So do we have any different solution to handle it? -
How can I delete a row by its SKU instead of its ID?
I try to delete the row using the sku of the product. I'm using spring boot and angular. I got an error when I added the sku on my button like this one
(click)="onDeleteProductBySku(deleteClick?.sku)"
it said that theProperty 'sku' does not exist on type '(product: Product) => void'.
. On my command prompt, I got this error. How can I solve this problem?Error: product/product.component.html:50:109 - error TS2339: Property 'sku' does not exist on type '(product: Product) => void'. 50 <button class="btn btn-outline-danger btn-sm me-2" (click)="onDeleteProductBySku(deleteClick?.sku)">Delete</button> product/product.component.ts:12:16 12 templateUrl: './product.component.html', ~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs in the template of component ProductComponent.
ProductsController.java --> This is working on the postman.
//Delete a product record using sku //http://localhost:8080/products/deletebysku?sku=12345678 @DeleteMapping("/products/deletebysku") @ResponseBody private void deleteProductBySku(@RequestParam String sku){ productsService.deleteProductBySku(sku); }
product.component.ts
public deleteProduct!: Product; public onDeleteProductBySku(sku: string): void { this.productServive.deleteProductBySku(sku).subscribe( (response: void) => { this.messageShow(); console.log(response); this.getAllProduct(); }, (error: HttpErrorResponse) => { this.errorMessage(error.message); } ); } public deleteClick(product: Product) { this.deleteProduct = product; console.log("delete by sku"); }
product.service.ts
public deleteProductBySku(sku: string): Observable<void> { return this.http.delete<void>(`${this.apiServerUrl}/products/deletebysku?sku=${sku}`); }
product.component.html
<button class="btn btn-outline-danger btn-sm me-2" (click)="onDeleteProductBySku(deleteClick?.sku)">Delete</button>
-
Multithreading using springboot
I’m new to multithreading and I want to know how to approach it for my code, currently files are getting generated and processed into fielder using single thread hence unable to handle bulk file generation abs this needs to be handled using multithreading . How do I approach this ? Using java 11 and xml format springboot approach .
-
WSO2 EI get attachement filename in SOAP request
I need to get the filename of the attachment given in a SOAP request. The SOAP request looks like this :
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:type="http://some.type/types"> <soap:Header/> <soap:Body> <type:RequestName> <type:Data>...</type:Data> <!--Optional:--> <type:myAttachement>cid:AAA</type:myAttachement> </type:RequestName> </soap:Body> </soap:Envelope>
When MTOM is enabled in SOAP UI, I can see the following in the log Wire :
DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> " <type:myAttachement><inc:Include href="cid:AAA" xmlns:inc="http://www.w3.org/2004/08/xop/include"/></type:myAttachement> DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> " </type:RequestName> DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> " </soap:Body>[\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "</soap:Envelope>" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "[\r][\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "------=_Part_2_1904033954.1651826827378[\r][\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "Content-Type: text/plain; charset=us-ascii; name=test.txt[\r][\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "Content-Transfer-Encoding: 7bit[\r][\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "Content-ID: <AAA>[\r][\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "Content-Disposition: attachment; name="test.txt"; filename="test.txt"[\r][\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "[\r][\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "AAABBBCCCDDD[\r][\n]" DEBUG {wire} - HTTP-Listener I/O dispatcher-2 >> "------=_Part_2_1904033954.1651826827378--[\r][\n]"
I can see the filename, Content-Type.. When I Debug the request in the sequence, the file content is inline the SOAP Payload :
<type:myAttachment>QUFBQkJCQ0NDRERE</type:myAttachment> </type:RequestName> </soap:Body></soap:Envelope>
How can I get in script mediator the attachment filename or at least the Content-Type of the attachment ?
-
Branded Fare - Amadeus SOAP/XML
Amadeus is offering to search branded fares from hundreds of top carriers with Branded Fares Upsell, now available in the Self-Service and Enterprise catalogs. Built for integration in your REST/JSON booking engine.
Is there anything similar to it but with SOAP/XML engine?
-
Problem with java classes generation from wsdl
I am trying to generate Java classes from this wsdl https://sedo.fss.ru/sedo-gateway/api/soap/SedoGateway?wsdl. I tried to do it with wsdl2java util, wsimport util but i get error all the time
Fail to create wsdl definition: WSDLException: Problem parsing 'http://sedo.fss.ru/sedo-gateway/api/soap/SedoGateway?wsdl=../Faults.wsdl' The element type "hr" must be terminated by the matching end-tag "/hr".
i also tried to do it with different maven plugins - same result.
-
Spring boot Web services - WSDL generation
I have followed this tutorial: https://spring.io/guides/gs/producing-web-service/ by Spring and works fine, however, I do not get part of it. The demo application takes an XSD file and generates a WSDL from it. My understanding is that XSD files are a subset of the WSDLs. How can the Spring framework figure out the missing information based on the XSD files only?