1

I am facing issue when am using in-memory-web-api with real api. when i am calling post call its not triggering it's looking in in-memory-web-api. I want to use in-memory-web-api for some pages because still my rest api is not ready. Some pages i got real service API. when I am integrating the real service its not triggering. After some long analysis i found out because of the in-memory-web-api is not working. Let me know if any way to use both in Angular5 application.

import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';

//import Section    

import { LocaldatasericeService }  from './localdataserice.service';
HttpClientInMemoryWebApiModule.forRoot(
  LocaldatasericeService, { dataEncapsulation: false }
)

Another one service.js I am calling the real post call.

getTables(): Observable<any[]> {
   let parser = new DOMParser();
   let xmlString ='<stp><parameters><selFilter>V</selFilter></parameters></stp>';
   let doc = parser.parseFromString(xmlString, "application/xml");
   return this.http.post<any[]>('http://blabla.phs.org:7980/SASBIWS/rest/storedProcesses/Web/hsd3_hsd_pcp_try_111/dataTargets/_WEBOUT',doc,httpOptions);
}

1 Answer 1

2

After adding passThruUnknownUrl: true in below configuration of app.module.ts it's started working.

@NgModule({
   imports: [
      ....
      HttpClientModule,
      ...
      HttpClientInMemoryWebApiModule.forRoot(
        LocaldatasericeService,{ dataEncapsulation: false,
        passThruUnknownUrl: true }
      )
      ...
  ]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.